Logo
(追記) (追記ここまで)

27481번 - Hotelier 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 256 MB31125422783.456%

문제

Amugae has a hotel consisting of 10ドル$ rooms. The rooms are numbered from 0ドル$ to 9ドル$ from left to right.

The hotel has two entrances --- one from the left end, and another from the right end. When a customer arrives to the hotel through the left entrance, they are assigned to an empty room closest to the left entrance. Similarly, when a customer arrives at the hotel through the right entrance, they are assigned to an empty room closest to the right entrance.

One day, Amugae lost the room assignment list. Thankfully Amugae’s memory is perfect, and he remembers all of the customers: when a customer arrived, from which entrance, and when they left the hotel. Initially the hotel was empty. Write a program that recovers the room assignment list from Amugae’s memory.

입력

The first line consists of an integer $n$ (1ドル\le n\le 10^5$), the number of events in Amugae’s memory.

The second line consists of a string of length $n$ describing the events in chronological order. Each character represents:

  • L’: A customer arrives from the left entrance.
  • R’: A customer arrives from the right entrance.
  • 0’, ‘1’, …, ‘9’: The customer in room $x$ (0ドル,ドル 1ドル,ドル …, 9ドル$ respectively) leaves.

It is guaranteed that there is at least one empty room when a customer arrives, and there is a customer in the room $x$ when $x$ (0ドル,ドル 1ドル,ドル …, 9ドル$) is given. Also, all the rooms are initially empty.

출력

In the only line, output the hotel room’s assignment status, from room 0ドル$ to room 9ドル$. Represent an empty room as ‘0’, and an occupied room as ‘1’, without spaces.

제한

예제 입력 1

8
LLRL1RL1

예제 출력 1

1010000011

예제 입력 2

9
L0L0LLRR9

예제 출력 2

1100000010

노트

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.

출처

Contest > Codeforces > Codeforces Round 578 (Div. 2) A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /