LGP3369_1 【模板】普通平衡树(Splay) 笔记
原题链接:传送门
题意简述
你需要动态维护一个可重集合 \(S\),共有 \(Q\) 次操作:
- \(\textrm{opt}=1\):向 \(S\) 中插入一个数 \(x\)。
- \(\textrm{opt}=2\):从 \(S\) 中删除一个数 \(x\)。
- \(\textrm{opt}=3\):查询 \(x\) 在 \(S\) 中的排名。
- \(\textrm{opt}=4\):查询 \(S\) 中排名为 \(x\) 的数。
- \(\textrm{opt}=5\):查询 \(x\) 在 \(S\) 中的前驱。
- \(\textrm{opt}=6\):查询 \(x\) 在 \(S\) 中的后继。