QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 512 MB Total points: 100

#6212. Bomb Attack

Statistics

Background

JYY has recently become obsessed with a tower defense game. In the game, besides building structures, JYY can also use bombs to deal area-of-effect damage to enemies on the screen.

Description

The game map can be simplified as a 2D plane.

JYY has built $N$ structures, each of which is a circle. The $i$-th structure has its center at $(x_i, y_i)$ and a radius of $r_i$.

There are $M$ enemies on the map. Each enemy can be approximated as a point on the plane, with the $i$-th enemy located at $(p_i, q_i)$.

JYY can use a bomb with an adjustable radius. He can set a range not exceeding $R$, and then choose a point on the plane to detonate it, eliminating all enemies within that range. Of course, because the bomb is extremely powerful, if the explosion range touches any of JYY's structures, those structures will also be damaged. (Note: If the explosion range only touches the boundary of a structure, it will not cause damage to the structure; if an enemy is exactly on the boundary of the explosion range, that enemy is eliminated.)

JYY can freely control the detonation location and the explosion radius. As a conservative player, he hopes to eliminate as many enemies as possible while ensuring his structures remain completely undamaged.

Input

The first line contains three non-negative integers $N$, $M$, and $R$.

The next $N$ lines each contain 3 integers, where the $i$-th line contains $x_i, y_i, r_i$, representing the position and radius of the $i$-th structure. It is guaranteed that all structures do not intersect (though they may touch at the boundaries).

The next $M$ lines each contain 2 integers, where the $i$-th line contains $p_i, q_i$, representing the position of the $i$-th enemy.

Output

Output a single integer representing the maximum number of enemies JYY can eliminate.

Examples

Input 1

1 5 3
0 0 1
3 3
-3 3
3 -3
3 0
0 3

Output 1

3

Input 2

4 10 100
0 0 3
10 0 3
10 10 3
0 10 3
0 4
0 5
0 6
5 3
5 -3
5 5
6 7
3 6
10 4
8 4

Output 2

5

Note

In the first example, the optimal attack is to detonate the bomb at $(3, 3)$ with a radius of $3$.

Constraints

  • For 20% of the data, $M = 2$.
  • For another 20% of the data, $N = 0$.
  • For another 20% of the data, $M \le 50$.
  • For 100% of the data, $0 \le N \le 10$, $0 < M \le 10^3$, $1 \le R, r_i \le 20000$, $|p_i|, |q_i|, |x_i|, |y_i| \le 20000$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.