rt,点我看测试点数据,求大佬指点!
#include <bits/stdc++.h>
using namespace std;
int n, ans;
struct Node
{
int p, t;
};
queue<Node> q;
signed main()
{
cin >> n;
while (n--)
{
int a, p, t;
cin >> a >> p >> t;
while (!q.empty() && t - (q.front()).t > 45) q.pop();
if (a == 0)
{
q.push({p, t});
ans += p;
}
else
{
if (!q.empty() && (q.front()).p >= p) q.pop();
else ans += p;
}
}
cout << ans << endl;
return 0;
}