#K10691. Seat Reservation System
Seat Reservation System
Seat Reservation System
You are given a seating layout of a theater with \(n=5\) rows and \(m=7\) columns. Initially, all seats are available. You will receive a list of seat reservation requests. Each request is given by two integers, representing the row and column indices (0-indexed) of the seat to reserve.
If the requested seat is within the bounds \(0 \leq row < 5\) and \(0 \leq col < 7\) and is available, it will be reserved (i.e. its status changes to "reserved"). Duplicate requests for the same seat have no additional effect, and requests for seats out of bounds must be ignored.
After processing all requests, output the seating layout as a grid where each line represents a row, and the statuses of the seats (either "reserved" or "available") are separated by a space.
inputFormat
The input is read from stdin and has the following format:
N row1 col1 row2 col2 ... rowN colN
Where N
(an integer) is the number of seat reservation requests. Each of the following N
lines contains two space-separated integers representing a seat's row and column indices.
outputFormat
The output should be printed to stdout as 5 lines. Each line corresponds to a row in the seating layout. Each line contains 7 space-separated strings, where each string is either "reserved" or "available", indicating the final status of the seat.
## sample1
1 2
available available available available available available available
available available reserved available available available available
available available available available available available available
available available available available available available available
available available available available available available available
</p>