Author: | Baranov A.A. | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Consider a set of rings on the plane. Each of these rings can be described by coordinates of its center (x, y), internal and external radius: q, r. It is known that any two circles bounding different rings do not cross each other.
Let us define a continuous mapping on this set that includes the next operations:
It is assumed that during these operations the bounding circles shouldn't intersect. Also, any ring shouldn't become singular (circle or point) during resizing. In other words, this mapping must keep the basic topological properties of the initial set.
Your program must, given two sets of the rings M1 and M2, determine whether there exist a continuous mapping to obtain M2 from M1 or not. It is assumed that order of rings in these sets may be different.
Input file contains integer n — number of rings in the each set, followed by 4 × n floating point numbers xi, yi, qi, ri — parameters of the rings of M1, and then followed by another 4 × n numbers — similar parameters of the rings of M2,
Output file must contain a single integer 1 — if M2 can be obtained by continuous mapping from M1 or 0 — otherwise.
All input values have no more than 3 digits after the decimal point.
− 105 < xi, yi < 105, 0 < qi < ri < 105, 1 ≤ n ≤ 2000
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|