Editorial for JDCC '16 Contest 1 P2 - Reddit at Work


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: aurpine

One part of the problem is the input. By reading in hours and minutes, make a function that converts hours and minutes to minutes past 9:00. To output, hours is minutes divided by 60, and minutes is minute\bmod 60. This makes the rest of the problem easier.

Store the latest ending time of a meeting so far (initialize to 9:00) and override as necessary. Keep a variable for the amount of wasted time (in seconds). If the current meeting's start time is after the latest ending time, then add the difference to the wasted time.

Time Complexity: \mathcal{O}(N)


Comments

There are no comments at the moment.