| acmsguru |
|---|
| Finished |
as a maximal (by inclusion) group of unoccupied neighboring slots and the
of a cluster as the number of slots in it. Correspondingly, define the
of a cluster as the number of the leftmost parking slot in the cluster (the first parking slot when you look over all parking slots of the cluster in clockwise direction), and call this parking slot the
of the cluster. If all parking slots in the system are unoccupied, then we treat it as one cluster consisting of all parking slots and having head slot number 1.
). The second line contains characters .and
X, which represent unoccupied and taken up slots in the system, respectively (starting from the first slot in clockwise direction). i-th character is indicator of whether i-th parking slot in the system occupied or not. The following Q lines contain queries of users. Every line represents i-th query and has one of the two forms:
PARK Si— group of Si users wants to land (1 ≤ Si ≤ N).
LEAVE Qi— group of users from query Qi wants to take off (1 ≤ Qi < i, queries are numbered from 1 to Q in the order they appear in the input file).
LEAVEquery cannot contain reference to another
LEAVEquery.
PARKquery in the input file output the only line containing description of set of parking slots allotted for corresponding group of users, or the message
NO ROOMif it is impossible to meet corresponding request.
sample input | sample output |
10 4 .......... PARK 4 PARK 3 LEAVE 1 PARK 4 | 1-4 5-7 1,8-10 |
sample input | sample output |
10 11 ....X..X.. PARK 1 PARK 3 PARK 4 LEAVE 2 PARK 5 LEAVE 5 PARK 1 PARK 1 PARK 2 PARK 4 PARK 3 | 6 1,9-10 NO ROOM 1-3,9-10 7 9 1,10 NO ROOM 2-4 |
| Name |
|---|


