#K81112. Restaurant Table Reservation System
Restaurant Table Reservation System
Restaurant Table Reservation System
You are managing a restaurant with N tables, each available for 24 discrete time slots (from 0 to 23). Customers send in reservation requests indicating a table number and a time slot. Your task is to process these requests. For each request, if the specified table is available at the given time slot, the reservation is Accepted and that slot becomes unavailable; if it is already reserved, the request is Rejected.
Formally, let \(T = \{1, 2, \ldots, N\}\) be the set of tables and each table \(t \in T\) has time slots \(S = \{0, 1, \ldots, 23\}\). For each reservation request \((t, s)\):
\[ \text{if } reservation[t][s] \text{ is already true, output} \; \texttt{Rejected}\; \text{else output} \; \texttt{Accepted} \text{ and mark } reservation[t][s]=\text{true}. \]inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains two integers \(N\) and \(M\), representing the number of tables and the number of reservation requests respectively.
- The next \(M\) lines each contain two integers: the table number \(t\) (1-based index) and the time slot \(s\) (an integer between 0 and 23).
outputFormat
For each reservation request, output a line containing either "Accepted" if the reservation is successful, or "Rejected" if the table's time slot is already reserved.
## sample3 5
1 5
2 5
1 5
3 20
2 5
Accepted
Accepted
Rejected
Accepted
Rejected
</p>