#P2313. [HNOI2005] 汤姆的游戏
[HNOI2005] 汤姆的游戏
Description
Tom is an energetic child, and today he becomes interested in a compass and a straightedge. He starts drawing many rectangles and circles on a very large sheet of white paper. While drawing, he accidentally spills his popcorn, and now there are many popcorn pieces on the paper. Tom notices that the popcorn looks like points on the plane: some points fall inside rectangles or circles, while others fall outside. He begins counting how many rectangles or circles each point lies inside. Since Tom is still a child and there are many points, rectangles, and circles, he cannot finish counting and asks you for help.
Your task is: given shapes (rectangles or circles) and points on the plane, determine for each point how many rectangles or circles contain it. Assume that each rectangle has sides parallel to the coordinate axes.
Input Format
The first line contains two positive integers and , where is the number of shapes (rectangles or circles) and is the number of points.
The next lines describe the shapes. Specifically, the -th line describes the -th shape. It starts with a letter: if the letter is r, the shape is a rectangle, followed by real numbers , which are the coordinates of a pair of opposite vertices and ; if the letter is c, the shape is a circle, followed by real numbers , meaning the circle is centered at with radius .
The last lines describe the points. Each of these lines contains two real numbers , representing a point at coordinates .
Output Format
Output lines. The integer on the -th line is the number of shapes that contain the -th point. If a point lies on the boundary of a shape, it is considered not inside that shape.
3 4
r 1.015 0.750 5.000 4.000
c 6.000 5.000 2.020
r 6.500 7.200 7.800 9.200
3.500 2.500
4.995 3.990
2.300 8.150
6.900 8.000
1
2
0
1
Hint
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号