#C10365. Booking Overlap Checker
Booking Overlap Checker
Booking Overlap Checker
You are given a list of existing bookings for a resource, where each booking is represented by its start time and end time in the 24-hour HH:MM format. Additionally, a new booking is proposed. Your task is to determine if the new booking can be accommodated without overlapping with any of the existing bookings.
Two time intervals \([a, b]\) and \([c, d]\) do not overlap if and only if $$b \leq c \quad \text{or} \quad a \geq d.$$
Note that if the new booking touches an existing booking (i.e. the end time of one is the start time of the other), it is not considered as an overlap.
This problem tests your ability to handle time comparisons and to implement interval scheduling correctly.
inputFormat
The input is given via standard input (stdin) as follows:
- The first line contains an integer n representing the number of existing bookings.
- The next n lines each contain two time stamps in the HH:MM format, representing the start time and end time of a booking, separated by space.
- The last line contains the start time and end time of the new booking in the HH:MM format, separated by space.
For example:
3 09:00 10:00 11:00 12:00 14:00 15:00 12:30 13:30
outputFormat
Output a single line to standard output (stdout) with the string "Yes" if the new booking does not overlap any existing bookings, and "No" otherwise.
## sample3
09:00 10:00
11:00 12:00
14:00 15:00
12:30 13:30
Yes