CIRCLES - Circles
Little Gary plays the following video game. Circles pop up on the screen and disappear from it. When the screen flashes, Gary can draw a straight line on the screen and win as many points as there are circles intersected by the line. As a born-to-be-winner, Gary wants to maximize his score. Please, help him, and write a program that will determine the maximum number of points he can win each time the screen flashes.
The first line of the input contains M (1 ≤ M ≤ 1000), the number of events during the game. The next M lines contain descriptions of the events, one per line. They can be in one of the following three formats:
1 x y r
, representing a circle of radius r popping up with the position of its center at (x, y) in the plane
, representing a circle i disappearing, where circle i is the ith circle that popped up since the beginning of the game; and
, representing the screen flashing.
x, y, and r are real numbers with at most two decimals, -106 < x, y, r < 106, r > 0.
- A line intersects a circle if it has at least two common points with it.
- At any time, no two Circles on the screen have a common point.
- At any time, there is no line that "touches" more than two circles (a line touches a circle if they have exactly one common point).
- At any time, there are no more than 100 circles on the screen.
- Each i determines a circle that is on the screen at the moment of removal.
- No circle is removed twice.
Each time the screen flashes, write an integer to a separate line, which is the maximum number of circles Gary can intersect.
Input: 9 1 3.00 0.00 1.00 1 -2.00 0.00 1.00 3 1 2.00 3.00 1.50 3 1 2.00 -4.00 1.00 3 2 3 3 Output: 2 2 3 2