2025-09-08 12:28:12
发布于:福建
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
struct node {
long long price , ti , used;
}a[N];
long long n ,head , tail , price , ti , ans;
int main( ) {
cin >> n;
for (int i = 1 ; i <= n ; i++) {
long long opt;
cin >> opt >> price >> ti;
if (opt == 0) {
a[tail] . price = price;
a[tail++].ti = ti * 45;
ans += price;
} else {
while (head < tail && a[head] . ti < ti) head++;
bool flag = 0;
for(int i = head ; i < tail ; i++){
if (a[i] . price >= price && a[i] . used == 0) {
flag = 1;
a[i] .used = 1;
break;
}
if (!flag) ans += price;
}
}
}
cout << ans << endl;
return 0;
}
很成功的WA了,救我救我
这里空空如也
有帮助,赞一个