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.