标签:std class insert main erase type node tag extc
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
typedef pair<int,int> pii;
tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> bbt;
int n;
int main(){
scanf("%d",&n);
for (int i=1,opt,k; i<=n; ++i){
scanf("%d%d",&opt,&k);
if (opt==1) bbt.insert(make_pair(k,i));
if (opt==2) bbt.erase(bbt.lower_bound(make_pair(k,0)));
if (opt==3) printf("%d\n",bbt.order_of_key(make_pair(k,0))+1);
if (opt==4){
auto t=*bbt.find_by_order(k-1);
printf("%d\n",t.first);
}
if (opt==5){
ans=*--bbt.lower_bound(make_pair(k,0));
printf("%d\n",ans);
}
if (opt==6){
ans=*bbt.upper_bound(make_pair(k,n));
printf("%d\n",ans);
}
}
}
洛谷P3369
标签:std class insert main erase type node tag extc
原文地址:https://www.cnblogs.com/Yuhuger/p/13849503.html