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$ です。

牛は新しいお気に入りのカードゲーム、ブリッジをするため 4 頭のグループを作りたいと考えています。重要な条件は、平面上に点 $X$(グループのどの牛の位置とも異なる)があり、どの牛も $X$ を中心に $180$ 度回転すると他のメンバーの位置になることです。この条件を満たす場合に限り組めます。

有効なブリッジグループを作れる 4 頭の集合数を求めてください。

例えば 8 頭が次の 8 点にいるとします。

                  |
                 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$ は空白区切りの 2 整数 $X_{i}$ と $Y_{i}$ です。

出力

  • 行 1:有効なブリッジグループを作れる 4 頭の集合数を整数 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.