代码厌氧开了全RE不开全AC
查看原帖
代码厌氧开了全RE不开全AC
1053567
__O_w_O__楼主2024/8/23 14:28
#include <bits/stdc++.h>
using namespace std;

const int N = 100010;
const int INF = (int) 1e9;

struct node {
    int flag, price, t;
} a[N];
int b[N], tot;
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d%d", &a[i].flag, &a[i].price, &a[i].t);
    }
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        if (!a[i].flag) {
            sum += a[i].price;
            b[++tot] = i;
        }
        
        else {
            int pos = 0;
            for (int j = tot; j >= tot - 45; j--) {
                if (a[b[j]].t + 45 >= a[i].t && a[b[j]].price >= a[i].price) pos = j;
            }
            if (pos) a[b[pos]].t = -INF;
            else sum += a[i].price;
        }
    }
    printf("%d\n", sum);
    return 0;
}

有没有大佬给解答一下啊QAQ

2024/8/23 14:28
加载中...