QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#543579#9178. All-You-Can-EatnekoyellowWA 1ms3504kbC++201.4kb2024-09-01 17:18:552024-09-01 17:18:55

Judging History

你现在查看的是最新测评结果

  • [2024-09-01 17:18:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3504kb
  • [2024-09-01 17:18:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

int query() {
    int ai;
    if (!(cin >> ai)) exit(0);
    return ai;
}

void solve() {
    int n;
    cin >> n;
    set<pii> a; int sum = 0;
    for (int i = 1; i <= n; i++) {
        int e = query();
        if (sum >= 600) {
            cout << "0\nIGNORE\n" << endl;
            continue;
        }
        if (e >= 600) {
            cout << a.size();
            for (auto [_, i]: a) cout << ' ' << i;
            cout << endl;
            a.clear();
            a.emplace(e, i);
            sum = e;
            cout << "TAKE\n" << endl;
            continue;
        }
        if (e <= 401) {
            cout << "0\nTAKE\n" << endl;
            a.emplace(e, i);
            sum += e;
            continue;
        }
        if (a.size() && a.begin()->first <= e) {
            cout << "0\nIGNORE\n" << endl;
        } else if (a.size()) {
            cout << 1 << ' ' << a.begin()->second << endl;
            sum -= a.begin()->first;
            a.extract(a.begin());
            a.emplace(e, i);
            sum += e;
            cout << "TAKE\n" << endl;
        } else {
            cout << "0\nTAKE\n" << endl;
            a.emplace(e, i);
            sum += e;
        }
    }
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);

    int t;
    cin >> t;
    for (; t; t--) solve();

    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3504kb

input:

1
5
10
13
450
585
465

output:

0
TAKE

0
TAKE

0
IGNORE

0
IGNORE

0
IGNORE


result:

wrong answer alg = 23 opt = 938 (test case 1)