样例1、2都没过、
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ends \
system("pause"); \
return 0;
int n, ans, start = 1;
struct node
{
int id, m, t;
} a[100010];
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i].id >> a[i].m >> a[i].t;
if (!a[i].id)
{
ans += a[i].m;
continue;
}
for (int j = start; j < i; j++)
{
if (a[j].id || a[j].m < a[i].m || a[j].t + 45 > a[i].t)
continue;
a[j].m = 0;
a[i].m = 0;
break;
}
ans += a[i].m;
}
cout << ans << endl;
ends
}
求调