QOJ.ac

QOJ

Time Limit: 5 s Memory Limit: 1024 MB Total points: 100

#6461. 对称性

Statistics

你感到非常无聊,无事可做。你注意到墙上的斑点图案,并开始盯着它们看。这里没有明显的对称规律。随着时间的推移,这变得非常令人烦躁,你打算增加更多的斑点来满足你对平衡的追求。对于这个练习,你需要用计算机程序来解决这种情况。

给定一组坐标范围在 $-20,000$ 到 $20,000$ 之间的斑点,确定为了使图案具有某种对称性,最少需要增加多少个斑点。对称性可以是关于一个点或关于一条线。如果对称性是关于一个点,该点不需要是数据中的一个斑点,甚至不需要是整数坐标的点。如果对称性是关于一条线,该线可以是任意角度。增加的斑点的坐标可能在 $-20,000$ 到 $20,000$ 的范围内,也可能不在。

输入格式

每个输入包含一个测试用例。注意,你的程序可能会在不同的输入上运行多次。输入的第一行包含一个整数 $n$ ($1 \le n \le 1,000$),表示斑点的数量。接下来的 $n$ 行,每行包含两个空格分隔的整数 $x$ 和 $y$ ($-20,000 \le x, y \le 20,000$),表示一个斑点的坐标。保证所有斑点的位置都是唯一的。

输出格式

输出一个整数,表示为了使所有斑点关于某一点或某一条线对称,最少需要添加的斑点数量。

样例

样例输入 1

4
0 0
1000 0
0 1000
1000 1000

样例输出 1

0

样例输入 2

11
0 0
70 100
24 200
30 300
480 400
0 100
0 200
0 400
100 0
300 0
400 0

样例输出 2

6

Figure 1. Symmetry around a Point and Symmetry around a Line

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.