Polylops
Time limit1sMemory limit128 MB
Given the vertices of a simple polygon, count how many distinct lines reflect it exactly onto itself.
- Level
Medium7 of 10
- Topics
- Geometry, String matching, Implementation
- Solved
- No attempts yet
Problem
You are given, in order, the vertices of a non-degenerate simple polygon (no 180-degree angles, no zero-length sides, and no self-intersections — but not necessarily convex). Determine how many distinct lines of symmetry the polygon has.
A line of symmetry is a line such that reflecting the polygon across it maps the polygon exactly onto itself.
Input
The input consists of the descriptions of several polygons.
Each polygon is described by two lines. The first line contains the integer (), the number of vertices of the polygon. The second line contains coordinate pairs (an value and a value each) giving the vertices of the polygon in order. All coordinates are integers between and .
The input terminates with a polygon that has vertices.
Output
For each polygon, print one line in the format Polygon #x has y symmetry line(s)., where is the number of the polygon (starting from 1) and is the number of distinct lines of symmetry of that polygon.