QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#543445#9178. All-You-Can-EatnekoyellowWA 1ms3576kbC++20887b2024-09-01 16:51:112024-09-01 16:51:19

Judging History

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

  • [2024-09-01 16:51:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3576kb
  • [2024-09-01 16:51:11]
  • 提交

answer

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

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

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

    int n;
    cin >> n;
    set<pii> a; int sum = 0;
    for (int i = 1; i <= n; i++) {
        int e = query();
        if (sum >= 600 || (a.size() && a.begin()->first > e)) {
            cout << "0\nIGNORE\n" << endl;
            continue;
        }
        vector<int> topop;
        while (sum + e > 1000) {
            auto [v, i] = *a.begin();
            a.extract(a.begin());
            topop.push_back(i);
            sum -= v;
        }
        cout << topop.size();
        for (auto i: topop) cout << ' ' << i;
        cout << endl;
        cout << "TAKE\n" << endl;
        a.emplace(e, i);
        sum += e;
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
5
10
13

output:

0
TAKE


result:

wrong output format Unexpected end of file - int32 expected (test case 1)