Area of Effect
Time limit5sMemory limit256 MB
Pick a circle of radius at most r that avoids the interiors of the village circles and covers as many minion points as possible.
- Level
Hard8 of 10
- Topics
- Geometry, Brute force
- Solved
- No attempts yet
Problem
Liam plays a tower defense game. He destroys his opponent's minions while defending his own villages.
Liam's favorite attack is an area of effect attack. The attack range is a perfect circle. Liam picks a center and a radius, and every minion inside that circle or on it is destroyed. A minion is a point with no size.
The attack must not damage Liam's villages. A village is also a perfect circle. The attack circle may touch the wall of a village, but it must not reach inside the village. For a village with center and radius , and an attack with center and radius , the distance between the two centers must be at least .
The attack radius has an upper limit . Liam can attack with a radius smaller than the limit, but never with a larger one.
Find the largest number of minions that one attack destroys without touching any village.
Input
The first line contains three integers , , separated by spaces.
- () is the number of villages.
- () is the number of opposing minions.
- () is the upper limit of the attack radius.
Each of the next lines contains three integers , , describing one village. is its center () and is its radius (). No two villages intersect or overlap.
Each of the next lines contains two integers , , the position of one minion (). No two minions share a position, and no minion is inside a village. A minion can be on the wall of a village.
Output
Print one integer, the largest number of minions destroyed by a single attack.