Type: Default 1000ms 256MiB

C. 插入与删除

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.

C. 插入与删除

题目描述

给定一个长度为 NN 的序列 AAAA 中的元素互不相同。

请你按照给定的顺序处理 QQ 次操作,每次操作有两种类型:

  • 1 x y:在元素 xx 后面插入 yy,保证 xxAA 中。
  • 2 x:把 xxAA 中移除,保证 xxAA 中。

处理完所有操作之后,请输出 AA

输入格式

N
A_1 ... A_N
Q
Query_1
...
Query_Q

Query 有两种可能:

1 x y
2 x

输出格式

输出最终的序列。

样例

4
2 1 4 3
4
2 1
1 4 5
2 2
1 5 1
4 5 1 3
6
3 1 4 5 9 2
7
2 5
1 3 5
1 9 7
2 9
2 3
1 2 3
2 4
5 1 7 2 3

数据范围与提示

  • 1<N<2×1031 < N < 2 \times 10^3
  • 1Q2×1031 \le Q \le 2 \times 10^3
  • 1Ai1091 \le A_i \le 10^9
  • AiAjA_i \neq A_j
  • 1 操作中 1x,y1091 \le x,y \le 10^9
  • 2 操作中 1x1091 \le x \le 10^9
  • 任意操作后,序列元素都互不相同

20260310

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