#P4631. Circle Deletion Simulation
Circle Deletion Simulation
Circle Deletion Simulation
Given n circles on a plane, denoted as \(c_1, c_2, \dots, c_n\), each defined by its center coordinates and radius, you are to simulate the following algorithm:
- Among the remaining circles, choose the circle with the largest radius. If there are multiple such circles, select the one with the smallest index. Denote this chosen circle as \(c_j\).
- Delete \(c_j\) and all circles that intersect with \(c_j\). Two circles are said to intersect if there exists a point in the plane that lies inside or on the circumference of both circles. Formally, circles \(c_a\) with center \((x_a, y_a)\) and radius \(r_a\) and \(c_b\) with center \((x_b, y_b)\) and radius \(r_b\) intersect if and only if \[ (x_a - x_b)^2 + (y_a - y_b)^2 \le (r_a + r_b)^2. \]
- Repeat the above steps until all circles are deleted. When a circle \(c_i\) is removed in a round where \(c_j\) is chosen in step 1, we say that \(c_i\) is deleted by \(c_j\). Note that a circle deletes itself when it is chosen.
Your task is to determine, for each circle, the index of the circle that deleted it.
inputFormat
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of circles.
Each of the next n lines contains three integers x, y, and r (|x|, |y| ≤ 104, 1 ≤ r ≤ 104), representing the center \((x, y)\) and the radius of a circle. The circles are indexed from 1 to n in the order given.
outputFormat
Output n integers separated by spaces. The i-th integer should be the index of the circle that deleted \(c_i\).
sample
3
0 0 1
1 0 1
10 10 1
1 1 3
</p>