样例都没过(┭┮﹏┭┮)```c
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,t,u,y,o=1;
bool q;
struct node{
int t,j;
bool u=1;
}p[100001];
int main(){
cin>>n;
p[0].u=0;
for(int i=1;i<=n;i++){
cin>>a>>b>>c;
if(a==0){
t+=b;
p[++u].t=c;
p[u].j=b;
}
else{
q=0;
while(c-45<=p[o].t)o++;
o-=1;
for(y=o;y<=u;y++){
if(p[y].j>=b&&p[i].u){
p[i].u=0;
q=1;
}
}
if(!q)t+=b;
}
}
cout<<t;
return 0;
}