上下代码除了偏移方式不同外没有区别,但上面是93分,下面AC,有什么区别吗?
#include <iostream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define N 10000000
using namespace __gnu_pbds;
using namespace std;
int q,otto;
tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update>
trr;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>q;
while (q--){
int opt,x;++otto;
cin>>opt>>x;
if(opt==1)trr.insert(x*N+otto-1);
if(opt==2)trr.erase(trr.lower_bound(x*N));
if(opt==3)cout<<trr.order_of_key(x*N)+1<<"\n";
if(opt==4)cout<<(int)(*trr.find_by_order(x-1)/N)<<"\n";
if(opt==5)cout<<(int)(*--trr.lower_bound(x*N)/N)<<"\n";
if(opt==6)cout<<(int)(*trr.lower_bound((x+1)*N)/N)<<"\n";
}
return 0;
}
#include <iostream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
int q,otto;
tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update>
trr;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>q;
while (q--){
int opt,x;
cin>>opt>>x;
if(opt==1)trr.insert((x<<20)+otto);
if(opt==2)trr.erase(trr.lower_bound(x<<20));
if(opt==3)cout<<trr.order_of_key(x<<20)+1<<"\n";
if(opt==4)cout<<(int)(*trr.find_by_order(x-1)>>20)<<"\n";
if(opt==5)cout<<(int)(*--trr.lower_bound(x<<20)>>20)<<"\n";
if(opt==6)cout<<(int)(*trr.lower_bound((x+1)<<20)>>20)<<"\n";
++otto;
}
return 0;
}