Editorial for TLE '17 Contest 8 P2 - Ship Defense
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
At every second:
- Sum the incoming damage directed at Fax's ship.
- Iterate through all defense modes and activate the one that reduces the most damage.
- Subtract the actual damage dealt to Fax's ship from its health points.
The answer is the remaining health of Fax's ship after the entire battle. If the ship has no more health points left, suggest Fax to do a barrel roll instead.
Time Complexity:
Comments