Problem D
Meet Me in the Middle
Languages
en
is
Two voters’ ideal policies can be represented by points in the plane $(x_1, y_1)$ and $(x_2, y_2)$. They each have a level of flexibility $r_1$ and $r_2$, 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.
These two voters want to find common ground where they agree. This common ground can take different shapes depending on where their ideal policy is located in the plane and how unhappy they are with the current state of affairs. The first voter is us and the second voter is them.
-
We cannot agree with them on anything, so it is impossible.
-
They are happy with any policy within our range of approval.
-
We are happy with any policy within their range of approval.
-
We can only agree with them on a single policy as a compromise.
-
We have many policies within our range of approval and their range of approval to choose from as potential compromises. This compromise range can be represented by the two points at which the edges of the ranges of approval intersect.
Note that the second and third case overlap slightly, when both voters have the exact same opinion.
Input
The first line contains three integers $x_1, y_1, r_1$, representing our ideal policy and our level of flexibility. The second line contains three integers $x_2, y_2, r_2$ representing their ideal policy and their level of flexibility.
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
-
impossible
-
our
-
their
-
compromise and two numbers $x, y$ representing the unique compromise policy.
-
compromises and four numbers $x_a, y_a, x_b, y_b$ representing the policies at which the edges of the ranges of approvals intersect. Output the policies in lexicographical order.
Your output is considered correct if it has at most a relative error of $10^{-6}$.
Sample Input 1 | Sample Output 1 |
---|---|
2 2 4 7 6 2 |
impossible |
Sample Input 2 | Sample Output 2 |
---|---|
5 4 10 9 7 5 |
their |
Sample Input 3 | Sample Output 3 |
---|---|
5 5 1 -4 -7 20 |
our |
Sample Input 4 | Sample Output 4 |
---|---|
0 0 5 16 12 15 |
compromise 4.0000000000000000 3.0000000000000000 |
Sample Input 5 | Sample Output 5 |
---|---|
-1 -1 2 1 1 2 |
compromises -1.0 1.0 1.0 -1.0 |
Sample Input 6 | Sample Output 6 |
---|---|
-5 2 4 -2 4 6 |
compromises -7.960164396867 4.690246595300 -3.655220218518 -1.767169672223 |