原题传送门
蒟蒻的眼泪……
下附代码
#include<iostream>
using namespace std;
const int maxx=1e5+1;
int main(){
int n,k,p,t;
int a[maxx]={0};
int jia[maxx]={0};
int shi[maxx]={0};
int ans=0,l=1,o=1;
cin>>n;
for(int i=1;i<=n;i++){
cin>>k>>p>>t;
if(k==0){
ans+=p;
jia[l]=p;
shi[l]=t+45;
l++;
}else{
for(int i=1;i<=l;i++){
if(t<=shi[i]&&jia[i]>=p){
o=0;
shi[i]=0;
jia[i]=0;
break;
}
}
if(o==1)ans+=p;
o=1;
}
}
cout<<ans;
return 0;
}