#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
const int N=1e5+5;
int rp;
int a[5*N];//记录的是函数为k得直线,需要减rp
set<int> s[5*N];
signed main(){
cin >> n;
int ac=0;//为直线总数
while(n--){
int op,k,b;
scanf("%lld%lld%lld",&op,&k,&b);
if(op==1){
if(a[k+N] < rp) a[k+N] = rp;
a[k+N]++;
s[k+N].insert(b+rp+N);
ac++;
}else if(op==2){
cout<<max(ac-max(a[k+N]-rp,0ll) ,0ll)<<"\n";
}else{
rp += 2*N+5;
a[k+N] = max(a[k+N] + 2*N+5,rp);
auto l = s[k+N].lower_bound(rp-2*N-5);
s[k+N].erase(s[k+N].begin(),l);
queue<int> q;
if(s[k+N].size())for(auto it:s[k+N]){
if((it % (2*N+5)) != N+b){
q.push(it+2*N+5);
}
s[k+N].erase(it);
if(!s[k+N].size()) break;
}
while(!q.empty()){
s[k+N].insert(q.front());
q.pop();
}
a[k+N] = ac = s[k+N].size();
}
}
return 0;
}
本蒟蒻马蜂奇特,思路奇怪,各位dalao将就帮忙调调,谢谢!!!
考场调了三个小时,快崩溃了(bei