Missile CommandTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 200 Accepted Submission(s): 3
As Chief Bureaucrat at Missile Command, it has recently come to your attention that the existing performance guidelines do not sufficiently penalize frivolous use of expensive ammunition. Therefore, you must write a new battle summary analysis tool which takes into account excess ammunition consumption during battle.
A battle consists of the following elements:
每 Shots. A shot is a circularly explosive countermeasure. A shot has a fixed position and a duration of 2 seconds, during which its radius varies from 0 to 1km and then back to 0 according to the formula:
r = (1 每 (t 每 1)2)1/2
每 The ground, at y = 0.
每 Missiles. A missile is a point particle that moves at a constant velocity. If a missile collides with a shot, it is neutralized. If a missile hits the ground before being neutralized, it is considered to have hit its target.
每 NOTE 1: If a missile hits a shot, the shot does not disappear 每 it may hit other missiles
每 NOTE 2: Shots of 0 radius cannot hit missiles (e.g. a missile will go through an already expired shot).
Performance is evaluated on a simple point scale. The performance criteria are as follows:
每 Every neutralized missile adds 1 point.
每 Every missile allowed to hit its target subtracts 5 points.
每 Every unnecessary shot subtracts 20 points. The number of unnecessary shots in a battle is the difference between the actual number of shots fired and size of the minimum subset of those shots that would have neutralized the same number of missiles.
Input will be given in the following format (legend follows):
mx my mdx mdy mt
sx sy st
In the following legend, indentation denotes repetition of the indented block a number of times equal to the value of the preceding input item:
nb (0 < nb) 每 number of battles
nm (0 <= nm <= 20) 每 number of missiles
mx/my (0.0 < my) 每 initial missile position (in km)
mdx/mdy 每 missile velocity (in km/s)
mt (0.0 <= mt) 每 time since battle start of the missile's entrance (in seconds)
ns (0 <= ns <= 20) 每 number of shots
sx/sy (1.0 <= sy) 每 shot position at time of detonation (in km)
st (0.0 <= st) 每 time since battle start of the shot's detonation (in seconds)
For each battle, output a line containing the score for that battle.