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.

Author: leonchen0613

At every second:

  1. Sum the incoming damage directed at Fax's ship.
  2. Iterate through all defense modes and activate the one that reduces the most damage.
  3. 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: \mathcal{O}(N^2)


There are no comments at the moment.