#P3260. [JLOI2014] 镜面通道
[JLOI2014] 镜面通道
Description
On a 2D plane, there is a mirror channel formed by mirrors and . The lengths of and are equal, and both are parallel to the -axis. is at (0, 0).
Inside the channel, there are optical elements whose outer surfaces are mirrors. Element is a circle, and element is a rectangle (these elements may intersect with other elements and with the channel; see the figures). A light ray can enter the channel from any point on at any angle, and the light ray does not attenuate. If an element just touches another element, or an element just touches the channel boundary, the light is considered unable to pass through at that contact (for example, two tangent circles).
All information about the elements in the channel is given ( elements include the center coordinates and radius ; elements include the lower-left and upper-right corner coordinates ).
As shown in the first figure, to is a valid path.
Of course, there are cases where the light cannot pass through. Your task is to find the minimum number of optical elements that must be removed so that there exists a light path that can exit from .
An example is shown below: if the middle rectangle is removed, a light path passing through the channel can be constructed, as shown by to .
Input Format
- The first line contains two integers, , denoting the coordinates of point .
- The second line contains an integer , the number of optical elements.
- Each of the next lines begins with a number. If it is , it denotes an element, followed by three integers for the circle’s center and radius. If it is , it denotes a element, followed by four integers for the rectangle’s lower-left and upper-right corner coordinates (rectangles are axis-aligned).
Output Format
Output one line containing a single integer , the minimum number of optical elements that need to be removed.
1000 100
6
1 500 0 50
2 10 10 20 100
2 100 10 200 100
2 300 10 400 100
2 500 10 600 100
2 700 0 800 100
2
Hint
Constraints: , , .
Translated by ChatGPT 5
京公网安备 11011102002149号