Problem D
Girðingaherping
A fence has been placed around the perimeter where a new building will be constructed. However, news have spread of budget cuts that are coming up, so the area for the building has to be made smaller. The mathematicians that were on call said that contractions work great for making areas smaller, so the plan was to contract the perimeter around a point until the area was halved. We will consider the perimeter to be a circular sequence of line segments. Therefore, the first and last segment are also adjacent. No two segments intersect, except for adjacent segments, which touch at their shared endpoint.
Once they started testing the procedure, they realized that it can leave some parts of the new area outside the old one, which is not an option. After lengthy talks with the geometers, a solution is suggested. The solution is to translate every line segment inward, perpendicular to its slope, by some fixed distance. The line segments then have to be lengthened or shortened accordingly so they continue to touch the adjacent line segments. Now it is simply a matter of figuring out what this fixed translation distance should be so the area is halved.
This works fine for some plans, but not others. As you translate the line segments, two of them could end up intersecting despite not being adjacent. Translations that cause two non-adjacent segments to intersect are invalid translations. Translations that cause two segments to translate through one another are invalid translations. All other translations are valid translations.
Input
The first line of input contains an integer
Output
If no valid translation halves the area, print “Omogulegt!”. Otherwise, print the distance by
which each line segment should be translated. Your answer will
be considered correct if its absolute or relative error is at
most
Sample Input 1 | Sample Output 1 |
---|---|
4 0 0 6828427 0 6828427 6828427 0 6828427 |
999999.981729615713 |
Sample Input 2 | Sample Output 2 |
---|---|
12 0 0 3 0 3 1 4 1 4 0 7 0 7 3 4 3 4 2 3 2 3 3 0 3 |
0.426092464751 |
Sample Input 3 | Sample Output 3 |
---|---|
12 0 0 300 0 300 125 400 125 400 0 700 0 700 300 400 300 400 175 300 175 300 300 0 300 |
Omogulegt! |