
| Contests | Virtual Contests | Problems | Submit | Runs Status | Rank List | Forum |
Your task will be to write a simulator that will keep track of books
added and removed from a shelf. At the end of the simulation, display
the books remaining on the shelf, in order from left to right. Books in
each simulation will be identified by a unique, positive integer, 0
< I ≤ 100. There are three
types of
events in the simulation:
Input: The input file will
contain data for one or more simulations. The end of the input is
signalled by a line containing -1. Each
simulation will begin with the integer width of the shelf, s, 5 ≤ s ≤ 100, followed by a series of add and remove events. An add event is a single line
beginning
with an upper case 'A'
followed by the book ID, followed by the integer width of the book, w, 0 < w ≤ s. A remove event is a single
line beginning with an upper case 'R'
followed by the the book ID. Finally, the end event is a line
containing only a single upper case 'E'. Each number in an event is
preceded by a single blank.
Output: For each simulation
case, print a single line containing a label (as shown in the output
sample), followed by the
list of IDs of books remaining on the shelf, in order
from left to right.
| Example input: | Example output: |
| 10 R 3 A 6 5 A 42 3 A 3 5 A 16 2 A 15 1 R 16 E 7 A 49 6 A 48 2 R 48 E 5 A 1 1 A 2 1 A 3 1 R 2 A 4 1 A 5 1 R 5 R 4 A 6 1 A 7 4 E -1 |
PROBLEM 1: 15 3 |