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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Authors:
,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 -hour clock system, Tommy's total sleep time is given by . This is because Tommy's sleep time before midnight is , and his sleep time after midnight is .
To determine if the sleep schedule is healthy, we can simply check if the following inequalities are satisfied:
- , which checks if the sleep time is in the healthy interval.
- , which checks if the wakeup time is in the healthy interval.
- , which checks if the total sleep time is in the healthy interval.
Time Complexity:
Comments