#include<bits/stdc++.h>
using namespace std;
long long n,res;
bool flag;
struct jl
{
bool subus;
long long jg,sj;
}ccjl[100002];
struct yhj
{
long long jg,zs;
bool wl;
}yhjjl[100002];
int main()
{
cin>>n;
for(long long i=1;i<=n;i++)
{
cin>>ccjl[i].subus>>ccjl[i].jg>>ccjl[i].sj;
if(!ccjl[i].subus)
{
yhjjl[i].jg=ccjl[i].jg;
yhjjl[i].zs=ccjl[i].sj+45;
yhjjl[i].wl=0;
}
}
for(long long i=1;i<=n;i++)
{
if(!ccjl[i].subus)
{
res+=ccjl[i].jg;
}
else
{
flag=0;
for(long long j=1;j<=i;j++)
{
if(yhjjl[j].zs>=ccjl[i].sj)
{
if(yhjjl[j].jg>=ccjl[i].jg)
{
if(!yhjjl[j].wl)
{
flag=1;
yhjjl[j].wl=1;
break;
}
}
}
}
if(!flag)
{
res+=ccjl[i].jg;
}
}
}
cout<<res;
return 0;
}
你看,才30分,全TLE,真的太逊了