Editorial for TLE '16 Contest 6 (Mock CCC) J1 - Paper Printing
Submitting an official solution before solving the problem yourself is a bannable offence.
Throughout the operation of the printer, we must keep track of how many pieces of paper are present at a specific time. This can either be monitored every second or, more efficiently, at every action.
To find out the current number of paper in the feed at any given action, we must first determine how much time elapsed since the previous action. Subtracting that from our previous paper count evaluates to the leftover number of paper currently in the feed. However, if that number is negative, it represents the amount of time prior to the current action since the printer started to overheat. Keep in mind that this will never occur before the previous action, since Leon cannot remove more paper from the feed than there currently is.
Time Complexity:
Comments