Type: Default 1000ms 256MiB

B. 插入序列

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

B. 插入序列

题目描述

给定一个长度为 1 的初始序列 A={0} A = \{0\} ,且唯一的初始值为 0 0 。 给定一个长度为 N N 操作序列 S S ,只包含 L L R R ,表示依次在 A A 中插入 1,2,3,,N 1, 2, 3, \dots, N ,具体插入的位置如下:

  • Si S_i L L 时,将 i i 插入 A A i1 i-1 的左侧。
  • Si S_i R R 时,将 i i 插入 A A i1 i-1 的右侧。

求最终的 A A 数列。

输入格式

N
S

输出格式

输出一行,为最终的序列,用空格隔开。

样例

5
LRRLR
1 2 4 5 3 0
7
LLLLLLL
7 6 5 4 3 2 1 0

数据范围与提示

  • 1<N<5×105 1 < N < 5 \times 10^5
  • S=N |S| = N
  • S S 只包括 L L R R

20260310

Not Claimed
Status
Done
Problem
13
Open Since
2026-3-1 0:00
Deadline
2026-3-31 23:59
Extension
24 hour(s)