[USACO11MAR] Bovine Bridge Battle S

题意翻译

农场主约翰有 $N$ 头牛,牛 $i$ 位于整数坐标点 $(X_i,Y_i)$。 奶牛们希望每四头牛分成一组,玩他们最喜欢的纸牌游戏“桥牌”。 每组必须满足一个重要的约束条件: 当且仅当平面中存在点 $X$ 时(一组的四个点允许重合,并且 $X$ 不与可能的组中的四个点中的任何一个相重合),使得组中的四个点呈中心对称。 请帮助奶牛确定可以组成一个桥群的四头奶牛的数量。 举个例子,假设八头牛站在八个点上: $a=(-3,1),b=(-2,2),c=(-3,0),d=(-2,0),e=(-1,1),f=(0,3),g=(2,0),h=(3,0)$ 四头牛的三个合法集合是: {$a,b,e,d$},关于 $ (-2,1)$ 对称, {$b,c,e,f$},关于 $(-1.5,1.5)$ 对称, {$c,d,g,h$},关于 $(0,0)$ 对称。 $4\le N\le 10^3$,$-10^8\le X_i,Y_i\le 10^8$,$X_i,Y_i\in Z$。

题目背景

给定N(4 <= N <= 1,000)个整点的坐标 (-1,000,000,000 <= X\_i <= 1,000,000,000; -1,000,000,000 <= Y\_i <= 1,000,000,000,X\_i,Y\_i∈Z),求card{{(X\_a,Y\_a),(X\_b,Y\_b),(X\_c,Y\_c),(X\_d,Y\_d)}|四点呈中心对称}

题目描述

Each of Farmer John's N (4 <= N <= 1,000) cows is patiently waiting in the main pasture with cow i at point with integer coordinates (X\_i, Y\_i) (-1,000,000,000 <= X\_i <= 1,000,000,000; -1,000,000,000 <= Y\_i <= 1,000,000,000). The cows wish to form into groups of four in order to play Bridge, their new favorite card game. Each group must satisfy an important constraint: four cows are allowed to team up if and only if there exists some point X somewhere in the plane (and not coincident with any of the four points of the potential group of four) such that rotating any of the group's cows 180 degrees about that point X gives the position of some other cow in the group. Please help the cows determine the number of sets of four cows that can form a Bridge group. By way of example, suppose eight cows are standing at eight points: | f\* ```cpp | 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 ---------\*--\*-----+-----\*--\*--------- | Then the three legal sets of four cows are {a, b, e, d} (they rotate around point (-2, 1)), {b, c, e, f} (around the point (-1.5, 1.5)), and {c, d, g, h} (around (0,0)). The supplied locations of the cows given are all distinct, although they are supplied in no particular order. Furthermore, the answer will fit into a signed 32-bit integer.

输入输出格式

输入格式


\* Line 1: A single integer: N \* Lines 2..N+1: Line i+1 contains two space-separated integers: X\_i and Y\_i

输出格式


\* Line 1: A single integer that is the number of sets of 4 cows that form valid groups for bridge.

输入输出样例

输入样例 #1

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

输出样例 #1

3