SP1962 CIRCLES - Circles
Description
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.
Input Format
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
2 _i_
, representing a circle _i_ disappearing, where circle _i_ is the _i_th circle that popped up since the beginning of the game; and
3
, representing the screen flashing.
_x_, _y_, and _r_ are real numbers with at most two decimals, _-10 $ ^{6} $_ < _x_, _y_, _r_ < _10 $ ^{6} $_ , _r_ > 0.
Notes:
- 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.
Output Format
Each time the screen flashes, write an integer to a separate line, which is the maximum number of circles Gary can intersect.