M: Thanos The Hero
https://open.kattis.com/problems/thanosthehero
Iterate through the populations in reverse. If you find a number that is larger than the previous number, change it to be one less than the previous number (and keep track of the total number of lives taken).
Print the total lives taken, or 1 if you change a population to a negative number.
Last updated