CF1200A Hotelier
题目描述
Amugae有一家10间客房的酒店,房间从左到右从0到9编号。
酒店有两个入口——一个在左端,另一个在右端。当顾客通过左边入口到达酒店时,他们被分配到离左边入口最近的那个空房间。同样,当客户通过右边的入口到达酒店时,他们被分配到离右边入口最近的那个空房间。
一天,Amugae失去了房间分配表单。谢天谢地,Amugae的记忆是完好的,他还记得所有的顾客:顾客什么时候到的,从哪个入口进入的酒店,以及他们什么时候离开酒店。最初这家酒店的房间都是空的。编写一个程序,从Amugae的记忆中恢复房间分配表单。
输入格式
第一行包含一个整数n(1≤n≤100000),表示Amugae记忆中的事件数。
第二行由一个长度为n的字符串组成,按时间顺序描述事件。其中每个字符含义:
“L”:表示客户从左侧入口进入酒店。
“R”:表示客户从右侧入口进入酒店。
'0'、'1'、…、'9':X房间的客户(分别为0、1、…、 9)离开。
数据保证客户到达时至少有一个空房间,且当X(0,1,…,9)给出时,X房间内有一个客户。并且,所有房间最初都是空的。
输出格式
一行,输出酒店房间的分配状态,从0房间到9房间。将空房间表示为“0”,占用的房间表示为“1”,没有空格。
**输入输出示例**
_**Mubuky's Translation**_
说明/提示
In the first example, hotel room's assignment status after each action is as follows.
- First of all, all rooms are empty. Assignment status is 0000000000.
- L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000.
- L: one more customer from the left entrance. Assignment status is 1100000000.
- R: one more customer from the right entrance. Assignment status is 1100000001.
- L: one more customer from the left entrance. Assignment status is 1110000001.
- 1: the customer in room $ 1 $ leaves. Assignment status is 1010000001.
- R: one more customer from the right entrance. Assignment status is 1010000011.
- L: one more customer from the left entrance. Assignment status is 1110000011.
- 1: the customer in room $ 1 $ leaves. Assignment status is 1010000011.
So after all, hotel room's final assignment status is 1010000011.
In the second example, hotel room's assignment status after each action is as follows.
- L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000.
- 0: the customer in room $ 0 $ leaves. Assignment status is 0000000000.
- L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000 again.
- 0: the customer in room $ 0 $ leaves. Assignment status is 0000000000.
- L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000.
- L: one more customer from the left entrance. Assignment status is 1100000000.
- R: one more customer from the right entrance. Assignment status is 1100000001.
- R: one more customer from the right entrance. Assignment status is 1100000011.
- 9: the customer in room $ 9 $ leaves. Assignment status is 1100000010.
So after all, hotel room's final assignment status is 1100000010.