QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21223. 奶牛桥牌之战

Statistics

Farmer John 的 $N$ 头奶牛 ($4 \le N \le 1,000$) 正耐心地在主牧场等待,奶牛 $i$ 位于整数坐标点 ($X_{i}$, $Y_{i}$),其中 $-1,000,000,000 \le X_{i} \le 1,000,000,000; -1,000,000,000 \le Y_{i} \le 1,000,000,000$。

奶牛想每四头一组,玩新近最喜欢的桥牌游戏。每组必须满足重要条件:四头奶牛能组队,当且仅当平面上存在某个点 $X$(不与组内任何一头奶牛的位置重合),使任意一头奶牛绕 $X$ 旋转 $180$ 度后,都到达组内另一头奶牛的位置。

请帮奶牛确定能组成合法桥牌小组的四头奶牛集合数量。

例如,假设八头奶牛分别位于下面八个点:

                  |
                 f*
                  |             a = (-3, 1)    e = (-1, 1)
           b*     |             b = (-2, 2)    f = ( 0, 3)
        a      e  |             c = (-3, 0)    g = ( 2, 0)
         *     *  |             d = (-2, 0)    h = ( 3, 0)
         c  d     |     g  h
---------*--*-----+-----*--*---------
                  |

三个合法集合是 $\{a,b,e,d\}$(绕点 $(-2,1)$ 旋转)、$\{b,c,e,f\}$(绕点 $(-1.5,1.5)$)和 $\{c,d,g,h\}$(绕点 $(0,0)$)。

输入的奶牛位置互不相同,但没有特定顺序。此外,答案能用有符号 32 位整数表示。

输入格式

  • 第 1 行:一个整数 $N$。
  • 第 $2 \ldots N+1$ 行:第 $i+1$ 行包含空格分隔的两个整数 $X_{i}$ 和 $Y_{i}$。

输出格式

  • 第 1 行:一个整数,表示能组成合法桥牌小组的四头奶牛集合数量。

样例

输入格式 1

8
-3 0
-2 0
-1 1
0 3
2 0
-3 1
3 0
-2 2

输出格式 1

3

题目作者:Richard Ho,2007

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.