rt,用的队列,样例都能过,评测听取WA声一片,求大佬指点!(测试数据点我)
#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;
}