#K11201. Detecting Obstacles by Robots

    ID: 23416 Type: Default 1000ms 256MiB

Detecting Obstacles by Robots

Detecting Obstacles by Robots

In a research laboratory, several robots are deployed with a fixed detection radius. Each robot is positioned at a certain coordinate and can detect any obstacle within or on the boundary of its detection circle. Obstacles are points on the laboratory floor. The distance is measured using the Euclidean distance, i.e., for a robot at ((x_i, y_i)) with detection radius (r_i) and an obstacle at ((o_x, o_y)), the obstacle is detected if

[ \sqrt{(x_i - o_x)^2 + (y_i - o_y)^2} \le r_i ]

Your task is to determine, for each robot, the number of obstacles it can detect.

Note: Use the formula above for Euclidean distance and compare the square of the distance with (r_i^2) to avoid precision issues.

inputFormat

The first line of the input contains two integers (n) and (m), where (n) is the number of robots and (m) is the number of obstacles. The next (n) lines each contain three integers (x_i), (y_i), and (r_i) denoting the coordinates and detection radius of the (i)-th robot. The following (m) lines each contain two integers representing the coordinates (o_x) and (o_y) of an obstacle.

outputFormat

Output (n) lines where the (i)-th line contains a single integer representing the number of obstacles detected by the (i)-th robot.## sample

3 4
0 0 5
10 10 10
-5 -5 1
1 1
6 6
-1 -1
11 11
2

2 0

</p>