Problems > Points Within Reach

Points Within Reach

Difficulty: 1200 6000 ms 128 MB

geometry

Given N points and Q circles, print how many points lie inside or on each circle.

Input: the first line has N; the next N lines are points; then a line with Q; then Q lines of cx cy r.

Output: one line per query.

Constraints:

  • 1 ≤ N, Q ≤ 2×103
  • |coordinates| ≤ 103
  • 0 ≤ r ≤ 2000

Sample Tests

Input 1
3
0 0
2 0
5 5
2
0 0 3
0 0 1
Output 1
2
1
Input 2
1
1 1
1
0 0 2
Output 2
1

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.