#K16011. Library Book Management
Library Book Management
Library Book Management
You are given a library consisting of n books with unique IDs. The library operations include borrowing and returning books. Each operation is represented by a query with two values: a command and a book ID.
The command is defined as follows:
0
indicates a request to borrow a book.1
indicates a request to return a book.
When borrowing a book that is already borrowed, output the error message: \(\texttt{Book \{book_id\} is already borrowed.}\). Conversely, when returning a book that is not borrowed, output the error message: \(\texttt{Book \{book_id\} is not borrowed.}\).
You must process q queries in the order given and print each error message on a separate line to stdout. If there are no errors, output nothing.
inputFormat
The first line of input contains two integers, n (the total number of books) and q (the number of queries). The next q lines each contain two integers: the first integer is the command
(0 for borrowing and 1 for returning) and the second integer is the book_id
.
The input is read from stdin.
outputFormat
For each invalid operation, print the corresponding error message on a separate line in the order they occur. If there are no error messages, print nothing. The output is written to stdout.
## sample5 8
0 1
0 2
1 2
0 2
1 3
1 3
0 1
0 3
Book 3 is not borrowed.
Book 3 is not borrowed.
Book 1 is already borrowed.
</p>