TopCoder

Y(OwO)Y
真実より 優しい嘘をプリーズ

User's AC Ratio

96.5% (82/85)

Submission's AC Ratio

29.1% (187/643)

Tags

Description

有一個動態的集合 $S$ ,以及四種指令:

指令效果
insert xx插入 $S$
remove xx從 $S$ 中移除
ask k找出集合中第k小的數
exit結束

一開始的時候 $S$ 是空的,另外如果要插入的數已經在 $S$ 裡或要移除的數不在 $S$ 裡請無視該指令。
而如果詢問的數不存在的話請輸出一行 “error”(不含雙引號)

Input Format

每個測試檔只會有一筆測資,測資有很多行,格式就按照上面所說的。
所有指令(除了 exit 之外)最多會有 $10 ^ 5$個,
而 insert 指令最多會有 $10 ^ 4$ 個。
指令中的參數都可以用 32 位元的有號整數儲存。

Output Format

對每個 ask 指令輸出一行回應

Sample Input 1

insert 7
insert 8
insert 9
ask 3
ask 2
ask 1
remove 8
ask 3
ask 2
ask 1
insert 7
ask 2
exit

Sample Output 1

9
8
7
error
9
7
9

Hints

Problem Source

原TIOJ1305 / [TIOJ] IOI2008 暖身賽 2(prob E)。Problem setter:akira。
2021.03.09 Update: Added $\LaTeX$ by FHVirus

Subtasks

No. Testdata Range Score
1 0 12
2 1 12
3 2 12
4 3 12
5 4 12
6 5 12
7 6 12
8 7 16

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 262144 1
1 1000 65536 262144 2
2 1000 65536 262144 3
3 1000 65536 262144 4
4 1000 65536 262144 5
5 1000 65536 262144 6
6 1000 65536 262144 7
7 1000 65536 262144 8