Editorial for Mock CCC '23 Contest 1 J2 - Healthy Schedule


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.

Authors: Marshmellon, Tommy_Shan

For this problem, we want to calculate Tommy's total sleep time and check if the conditions meet the requirements for a healthy schedule. Since the input is given in the 24-hour clock system, Tommy's total sleep time is given by 24S+W. This is because Tommy's sleep time before midnight is 24S, and his sleep time after midnight is W.

To determine if the sleep schedule is healthy, we can simply check if the following inequalities are satisfied:

  • 20S23, which checks if the sleep time is in the healthy interval.
  • 6W9, which checks if the wakeup time is in the healthy interval.
  • 824S+W10, which checks if the total sleep time is in the healthy interval.

Time Complexity: O(1)


Comments

There are no comments at the moment.