#C8707. Booking Conflict Checker
Booking Conflict Checker
Booking Conflict Checker
In this problem, you are given a list of existing room bookings and a new booking request. Each booking is represented as a time interval [start, end) using integer values (for example, 900 represents 9:00 AM). Two bookings conflict if their time intervals overlap, i.e., if the new booking's start time is less than an existing booking's end time and its end time is greater than the existing booking's start time. Mathematically, a conflict exists if ( s_{new} < e ) and ( e_{new} > s ) for any booking interval ([s, e)).
Your task is to determine whether the new booking conflicts with any of the existing bookings. Print "True" if there is a conflict, otherwise print "False".
inputFormat
The input is given via standard input (stdin) and has the following format:
- The first line contains an integer ( n ) representing the number of existing bookings.
- Each of the next ( n ) lines contains two integers representing the start and end times of a booking.
- The last line contains two integers representing the start and end times of the new booking request.
For example: 4 900 1100 1300 1500 1600 1700 1800 1900 1000 1400
outputFormat
The output should be printed to standard output (stdout) as a single line containing either "True" if the new booking conflicts with any existing booking, or "False" otherwise.## sample
3
900 1100
1300 1500
1600 1700
1000 1400
True