Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- using namespace __gnu_pbds;
- using namespace std;
- typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
- int main() {
- indexed_set s;
- int q, type, k;
- cin >> q;
- while (q --) {
- cin >> type >> k;
- if (type == 1)
- s.insert (k);
- else if (type == 0) {
- auto x = s.find_by_order (s.size() - k);
- cout << *x << endl;
- } else
- s.erase (s.find (k));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement