0分评测记录
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <deque>
#include <map>
#include <utility>
using namespace std;
int n,ans,opp,price,t;
bool have=0;
struct node{
int price,t;
bool yg=0;
};
deque<node> pr;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>opp>>price>>t;
if(!opp){
ans+=price;
pr.push_back({price,t+45});
}
else{
while(!pr.empty()&&pr.front().t<t){
pr.pop_front();
}
have=0;
for(auto p:pr){
if(p.price>=price&&!p.yg){
have=1;
p.yg=1;
break;
}
}
if(!have) ans+=price;
}
}
cout<<ans<<endl;
return 0;
}