As Chief Bureaucrat at Missile Command, you have recently noticed that the existing performance guidelines do not sufficiently penalize frivolous use of expensive ammunition. You must therefore write a new battle-summary analysis tool that also accounts for excess ammunition consumption during a battle.
A battle consists of the following elements.
- Shots. A shot is a circularly exploding countermeasure. A shot has a fixed position and stays active for 2 seconds after it detonates. During that time its radius grows from 0 to 1 km and shrinks back to 0, following, for the time $t$ elapsed since detonation ($0 \le t \le 2$, in seconds):
$$r = \sqrt{1 - (t - 1)^2}$$
- The ground, at $y = 0$.
- Missiles. A missile is a point particle that moves at constant velocity. It enters the battlefield at time $mt$ at position $(mx, my)$ and travels with velocity $(mdx, mdy)$; that is, at any time $T \ge mt$ its position is $(mx + mdx,(T - mt),\ my + mdy,(T - mt))$. If a missile collides with an active shot — that is, at some instant the missile's position lies inside that shot's disk (its distance to the center is at most the radius) — the missile is neutralized, and the shot persists. If a missile reaches the ground before being neutralized, it is considered to have hit its target.
Performance is scored on a simple point scale.
- Every neutralized missile adds $1$ point.
- Every missile that hits its target subtracts $5$ points.
- Every unnecessary shot subtracts $20$ points. The number of unnecessary shots in a battle is the difference between the number of shots actually fired and the size of the minimum subset of those shots that would have neutralized the same number of missiles.