#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace std;
using namespace __gnu_pbds;
tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> t;
int n;
int k, res;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i ++) {
int op;
cin >> op >> k;
switch (op) {
case 1: t.insert ((k << 20) + i); break;
case 2: t.erase (t.lower_bound (k << 20)); break;
case 3: cout << t.order_of_key ((k << 20)) + 1 << endl; break;
case 4: cout << ((*t.find_by_order (k - 1))>>20) << endl; break;
case 5: cout << ((*--t.lower_bound (k << 20 ))>>20) << endl; break;
case 6: cout << (*t.upper_bound((k << 20) + n) >> 20) << endl; break;
}
}
}剪贴板
剪贴板 2w594vqf
剪贴板信息
剪贴板信息
- 收录
- 更新