#include<bits/stdc++.h>
using namespace std;
struct ticket
{
long long time,money;
bool b;
}t[114514];
int main()
{
long long n,head=0,tail=0,op,m,tm,x;
long long sum=0;
cin>>n;
for(int y=0;y<n;y++)
{
cin>>op;
if(op==0)
{
cin>>m>>tm;
t[tail].money=m;
t[tail].time=tm;
t[tail].b=0;
tail++;
sum+=m;
}
else
{
cin>>m>>tm;
for(int z=head;;z++)
{
if(tm-t[z].time<=45)
{
head=z;
break;
}
if(z==tail)
{
head=tail;
break;
}
}
x=-1;
for(int z=head;z<=tail;z++)
{
if(m<=t[z].money&&t[z].b==0&&tm-t[z].time<=45)
{
x=z;
break;
}
}
if(x==-1)
{
sum+=m;
}
else
{
t[x].b=1;
}
}
// cout<<sum<<" "<<m<<endl;
}
cout<<sum;
return 0;
}
rt,学校的CSP-J模拟赛爆60,平均分105
平时只能切橙题,但是赛时勉强能切绿题
而且每次考完都要红温(39度左右),是什么情况(生物牢师:肾上腺素)
CSP-J : [280−320]
CSP-S : [140−180]
地区:福建
年级:初一