Submit | All submissions | Best solutions | Back to list |
Problem hidden
SPEEDCAM - Speed Camera |
Rin is a student in programming course. She is going to make a game. But, she is a bit concerned about optimization. Please help Rin in making a game!
This game is very simple. It is called speed camera game. Speed camera is a tool that's used to capture speed of vehicle. The world is represented as X-Y cartesian coordinate system. There are N speed camera placed on (x, y) position. Each camera has R value which is a detection range (R is float and a radius from (x,y) forming a circle). There are M vehicle are a accelerating and at specific position (Vx, Vy), get detected by a speed camera. Find out which speed camera detects the vehicle!
Input
First line, given N (1 <= N <= 10^5).
2nd to (N+1)-th line, given x y R (1.0 <= R <= 20.0, -20000 <= x <= 20000, -20000 <= y <= 20000)
(N+2)-th line, given M (1 <= M <= 100)
For the next M line, given Vx and Vy (-20000 <= Vx <= 20000, -20000 <= Vy <= 20000)
Output
For each M, print index of the speed camera which detected the vehicle. If there are more than 1 speed camera detecting the vehicle, print index of the speed camera which is closer to the vehicle. Print -1 if the vehicle is not detected by any speed cameras.
Example
Input: 3 1 2 10.0 10 3 8.0 1 -5 10.0 3 5 5 10 15 -5 -5 Output: 0 -1 2
Added by: | Ryan Garnet Andrianto |
Date: | 2021-08-29 |
Time limit: | 0.100s-0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |