eolymp
bolt
Try our new interface for solving problems
Məsələlər

Missile Command

Missile Command

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: \begin{itemize} \item Shots. A shot is a circularly explosive countermeasure. A shot has a fixed position and a duration of \textbf{2} seconds, during which its radius varies from 0 to 1km and then back to 0 according to the formula: \end{itemize} \textbf{r = (1 -- (t -- 1)^2)^\{1/2\}} \begin{itemize} \item The ground, at \textbf{y} = \textbf{0}. \item 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. \item NOTE 1: If a missile hits a shot, the shot does not disappear -- it may hit other missiles \item NOTE 2: Shots of 0 radius cannot hit missiles (e.g. a missile will go through an already expired shot). \end{itemize} Performance is evaluated on a simple point scale. The performance criteria are as follows: \begin{itemize} \item Every neutralized missile adds \textbf{1} point. \item Every missile allowed to hit its target subtracts \textbf{5} points. \item Every unnecessary shot subtracts \textbf{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. \end{itemize} \InputFile Input will be given in the following format (legend follows): \textit{nb} \textit{nm} \textit{mx my mdx mdy mt} ... \textit{ns} \textit{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: \textit{nb} (0 < \textit{nb}) -- number of battles \textit{nm} (0 <= \textit{nm} <= 20) -- number of missiles \textit{mx/my} (0.0 < \textit{my}) -- initial missile position (in km) \textit{mdx/mdy} -- missile velocity (in km/s) \textit{mt} (0.0 <= \textit{mt}) -- time since battle start of the missile's entrance (in seconds) \textit{ns} (0 <= \textit{ns} <= 20) -- number of shots \textit{sx/sy} (1.0 <= \textit{sy}) -- shot position at time of detonation (in km) \textit{st} (0.0 <= \textit{st}) -- time since battle start of the shot's detonation (in seconds) \OutputFile For each battle, output a line containing the score for that battle.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 128 MiB
Giriş verilənləri #1
2
2
4.0 8.0 0.0 -1.0 0.0
4.0 8.0 1.0 -1.0 0.0
1
4.0 4.0 3.0
3
4.0 10.0 0.0 -1.0 0.0
5.0 10.0 3.0 -6.0 4.0
13.0 10.0 -3.0 -5.0 4.0
3
4.0 5.0 3.0
7.0 8.0 4.0
9.0 4.0 4.0
Çıxış verilənləri #1
-4
-17
Mənbə Pacific North West Region Programming Contest, 2007