#P10936. Missile Defense Scheduling
Missile Defense Scheduling
Missile Defense Scheduling
Freda's castle is under attack by \(M\) invaders! To defend the castle, Freda controls \(N\) missile defense towers. Each tower has an unlimited supply of missiles but can fire only one missile at a time.
When a tower fires a missile, it takes \(\frac{T_1}{60}\) minutes to launch the missile. Immediately after firing, the tower enters a cooldown period of \(T_2\) minutes before it can fire again. All missiles travel with a constant speed \(V\), and they fly along the shortest (horizontal) path toward their target. The flight time for a missile is \(\frac{Distance}{V}\) minutes, where \(Distance\) is the Euclidean distance (ignoring vertical height) between the tower and the target. A missile destroys its target immediately upon arrival.
When the same tower fires multiple missiles, if we index the shots starting at \(0\), then the hit time for the \(k\)-th missile fired from a tower (with \(k = 0,1,2,\dots\)) aimed at an intruder at distance \(d\) is given by:
[ \text{HitTime} = \frac{T_1}{60} + k\Bigl(\frac{T_1}{60} + T_2\Bigr) + \frac{d}{V}. ]
Your task is to compute the minimum number of minutes required to destroy all intruders by appropriately scheduling missiles from the towers.
inputFormat
The input begins with a line containing five numbers: \(N\), \(M\), \(T_1\), \(T_2\) and \(V\), where \(T_1\) is given in seconds and \(T_2\) in minutes.
This is followed by \(N\) lines, each containing two numbers representing the coordinates of a missile defense tower.
Then \(M\) lines follow, each containing two numbers representing the coordinates of an intruder.
outputFormat
Output a single number: the minimum number of minutes required to destroy all intruders. The answer should be printed with a precision that passes the given test cases.
sample
1 1 60 1 1
0 0
3 4
6.000000
</p>