QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#543445 | #9178. All-You-Can-Eat | nekoyellow | WA | 1ms | 3576kb | C++20 | 887b | 2024-09-01 16:51:11 | 2024-09-01 16:51:19 |
Judging History
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)