#C14636. The Theater Seat Booking
The Theater Seat Booking
The Theater Seat Booking
A local theater has two screens: Screen1
with 50 seats and Screen2
with 75 seats. Your task is to implement a simple booking system that processes a sequence of booking requests. For each booking request, if the specified screen exists and has enough seats, the booking succeeds and the available seat count is reduced accordingly. Otherwise, if there are not enough seats available, the booking fails with an appropriate message. If the screen name is invalid, your program should return an error message.
For each booking request, print one of the following messages:
- Booking successful – if the booking is completed.
- Not enough seats available – if the requested number of seats exceeds the available seats on that screen.
- Screen not found – if the provided screen identifier does not exist.
All requests are processed sequentially.
inputFormat
The first line of the input contains an integer \(n\) representing the number of booking requests. Each of the next \(n\) lines contains a screen identifier (a string) and an integer representing the number of seats to book, separated by a space.
outputFormat
For each booking request, output a single line with one of the following messages:
Booking successful
Not enough seats available
Screen not found
1
Screen1 30
Booking successful
</p>