Ans
X-wangyiquan
2023-03-18 16:07:55
22
返回题目
#include <bits/stdc++.h>
using namespace std;
int n, a, m, t, ty, cmp = 0, ans = 0, x, h, f;
struct q {
int m, t;
} p[100001];
int main() {
cin >> n;
h = 1, t = 0;
for (int i = 1; i <= n; i++) {
cin >> a >> m >> ty;
if (a == 0) {
ans += m;
t++;
p[t].t = ty;
p[t].m = m;
} else {
while (h <= t && p[h].t + 45 < ty) h++;
for (int i = h; i < t; i++)
if (p[i].m >= m)
p[i].m = -1;
f = 1;
break;
}
if (f == 0)
ans += m;
}
cout << ans;
return 0;
}
{{ vote && vote.total.up }}