|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||6||6||6||100.000%|
Air NZ (not to be confused with Air New Zealand) operate flights between various smaller cities in New Zealand. They have a number of Aerospatiale ATR72 aircraft, each with 68 seats. Their policy is that passengers must book for a particular flight, and if they fail to show up then they lose their fare. That means that, unlike other airlines, they do not have to overbook flights, so a maximum of 68 seat bookings may be made for any flight.
In this problem you will be given one or more scenarios. Each scenario begins with a flight number and a current number of booked seats, n, (0 <= n <=68). The flight number will be the letters AZ followed by 3 digits, which will be followed by a space.
A number of transactions will follow, each on a single line. If the transaction is to book one or more seats, this will be presented as an upper case B followed by a space followed by an integer, n, which is the number of seats to book (0 < n <=68). Should the number of bookings requested take the number of bookings for the flight to more than 68, then that transaction must be completely ignored.
Customers may also cancel a booking - this will be presented as an upper case C followed by a space followed by an integer, n, which is the number of seats to cancel (0 < n <=68). Should n be greater than the number of seats currently booked, then that transaction must be completely ignored.
The list of transactions will be terminated by a line containing X 0 (separated by a space) which should not be processed. A line containing # 0 (separated by a space) marks the end of input.
Output consists of one line for each flight. The line contains the flight number, followed by a space, followed by the number of seats booked for that flight after the transactions have been carried out.
AZ001 5 B 10 B 1 B 2 C 1 B 3 C 1 C 4 B 2 B 1 B 1 B 5 C 3 X 0 AZ002 60 C 61 B 9 X 0 # 0
AZ001 21 AZ002 60