Problem list
Log in
#usaco0034 · USACO 2011-2012 February Gold

Symmetry

Gold I 2.0 s 256 MB

After taking a modern art class, Farmer John has become interested in finding geometric patterns in everything around his farm. He carefully plots the locations of his N cows (2 <= N <= 1000), each one occupying a distinct point in the 2D plane, and he wonders how many different lines of symmetry exist for this set of points. A line of symmetry, of course, is a line across which the points on both sides are mirror images of each-other.

Please help FJ answer this most pressing geometric question.

Input

  • Line 1: The single integer N.
  • Lines 2..1+N: Line i+1 contains two space-separated integers representing the x and y coordinates of the ith cow (-10,000 <= x,y <= 10,000).

Output

The number of different lines of symmetry of the point set.

Example 1

Input
4
0 0
0 1
1 0
1 1
Output
4

Input details: The 4 cows form the corners of a square.

Output details: There are 4 lines of symmetry -- one vertical, one horizontal, and two diagonal.

Source
USACO 2011-2012 February Gold
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code