Glyph Recognition
Time limit2sMemory limit512 MB
For each k from 3 to 8, fit the largest origin-centered regular k-gon with a vertex on the +x axis avoiding all points and the smallest one containing all points, then report the k with the best area ratio.
- Level
Medium5 of 10
- Topics
- Geometry, Binary search, Math, Implementation
- Solved
- No attempts yet
Problem
You are an archaeologist at an excavation site, and your team has dug up hundreds of clay tablets covered with glyphs of an ancient language. Little is known about the language so far, but there are only six different glyphs. Each one is a regular polygon with 3 to 8 corners, drawn with one corner pointing to the right, as in Figure G.1(a). Only the boundary of each polygon is carved out of the clay.
Figure G.1
You want to start analysing the language right away, so the writing has to be turned into a machine readable form. An OCR tool would be ideal, but none is installed on your laptop and there is no internet connection at the site.
So you digitise the tablets yourself. For every glyph you first collect a number of sample points that lie in the carved out region, that is, on the boundary of the polygon. From those points you compute a score for each of the six glyphs, and the glyph with the highest score is the recognised one.
For a given number of corners () the score is computed as follows. Two regular -gons are fitted to the sample points, one from the inside and one from the outside, so that all of the following hold.
- Each polygon is centered at the origin, so all of its vertices have the same distance to .
- Each polygon has a vertex on the positive axis.
- The inner polygon is the largest such polygon that contains none of the sample points.
- The outer polygon is the smallest such polygon that contains all of the sample points.
Figure G.1(c) shows an example. The score for this value of is , where and are the areas of the inner and the outer polygon.
Given the sample points, find the glyph with the highest score.
Input
The first line contains one integer (), the number of sample points.
Each of the next lines contains two integers and (), one sample point at coordinates .
No sample point is at the origin, and all points are distinct.
Output
Print the number of corners of the recognised glyph, then a space, then the score of that glyph rounded to exactly 10 digits after the decimal point.
The score you print is the highest score over all from 3 to 8. If several values of reach a score that differs from the highest score by at most , print the smallest such . Every test is built so that the 10th digit after the decimal point is unambiguous.


