Hide

Problem E
Meet Us in the Middle

Languages en is

Note: this is a continuation of Meet Me in the Middle.

There are $n$ voters. The $i$-th voter’s ideal policy can be represented by a point in the plane $(x_i, y_i)$. Each voter has a level of flexibility $r_i$, representing how far a policy can be from their ideal policy such that they are still happy, instead of unhappy. We say those policies are in the voter’s range of approval. Many different distance metrics may be used, but we will use Euclidean distance here. Each voter can therefore be represented by a disc.

These voters want to find common ground where they agree. This common ground can take different shapes depending on where their ideal policies are located in the plane and how unhappy they are with the current state of affairs. Note that some voters are irrelevant because some other voter’s disc is completely within that voter’s disc and therefore can be removed.

  1. Some of the discs do not intersect. It is impossible to find common ground in this case.

  2. One of the discs is completely within all other discs. Then that voter represents the common ground.

  3. There is a non-trivial intersection of discs. The intersection points of the circles which are inside all circles can be used to analyze the region further.

Input

The first line contains an integer $n$, the number of voters, where $1 \leq n \leq 500$. Then $n$ lines follow, the $i$-th of which containing three integers $x_i, y_i, r_i$, representing the $i$-th voter.

All coordinates are between $-10^6$ and $10^6$, inclusive. All radii are between $1$ and $2 \cdot 10^6$, inclusive. You may assume all voters are unique.

Output

Depending on which shape of common ground we have, output

  1. impossible

  2. voter and the number of the voter whose disc is completely within all other discs.

  3. compromise followed by an integer $k$ representing the number of intersection points. Then $k$ lines follow, each with two numbers $x, y$ and then a sequence of (at least two) integers representing the voters that create the intersection points. The intersection points should be sorted in lexicographical order by the voters that form them. Each list of voters should be sorted in ascending order.

Your output is considered correct if it has at most a relative error of $10^{-6}$.

Sample Input 1 Sample Output 1
1
0 0 10
voter 1
Sample Input 2 Sample Output 2
3
0 0 1
3 0 1
50 50 1000
impossible
Sample Input 3 Sample Output 3
3
75 83 62
6 62 78
45 89 100
compromise 2
72.3890578633145208 21.0550003538713363 1 2
38.3225915023140836 132.9876755400156302 1 2
Sample Input 4 Sample Output 4
4
19 86 68
34 46 54
87 19 68
94 62 65
compromise 4
84.0646935600472246 66.2367600850177092 1 2
42.5915250314730091 22.2235157233531535 1 4
71.2032546416990518 85.1397220744462869 2 3
29.3682060413785008 55.0912222723337324 3 4
Sample Input 5 Sample Output 5
5
-4 -7 90
40 30 100
3 4 54
-6 10 70
0 -20 80
voter 3
Sample Input 6 Sample Output 6
5
0 2 3
0 2 2
2 0 2
0 -2 2
-2 0 2
compromise 1
0.0000000000000000 0.0000000000000000 2 3 4 5
Sample Input 7 Sample Output 7
5
-16 63 65
-63 16 65
8 -57 65
55 -10 65
-4 3 5
compromise 6
0.0000000000000001 0.0000000000000000 1 2 5
-6.5384615384615385 -1.3076923076923077 1 5
0.8904109589041096 4.0410958904109588 2 5
-8.0000000000000000 6.0000000000000000 3 4 5
-1.4615384615384615 7.3076923076923077 3 5
-8.8904109589041096 1.9589041095890412 4 5

Please log in to submit a solution to this problem

Log in