Partitioning the plane
All submissions for this problem are available.
You are given the coordinates of 4*K+5 points on a plane such that no three of them are collinear. You need to select five points from these : a central point O and four arm points A,B,C,D such that:
- Rays from the centre to the arm points divide the plane into four regions containing an equal number of points
- None of the four central angles is a reflex angle
- Sum of absolute values of the cotangents of the central angles is as low as possible
If it is possible to choose points satisfying this condition, output the lowest possible value for the sum of absolute values of the cotangents of the central angles. Otherwise report that it is not possible.
The first line of input contains T(<=4), the number of test cases. Following this are the descriptions of the T test cases.
The first line in the description of each test case gives K(<=100). Following this are 4*K+5 lines giving the x and y coordinates of each point separated by a space (0<=x,y<=106)
For each test case output in a different line the minimum sum of absolute values of the cotangents of the central angles, with six digits after the decimal point. If the division cannot be done in the manner explained, print Impossible
Input: 2 0 0 0 0 1 1 1 1 0 2 3 0 0 0 2 0 0 1 2 1 1 2 Output: 4.000000 Impossible
|Time Limit:||6 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, GO, NODEJS, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.