QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#543454 | #9178. All-You-Can-Eat | nekoyellow | WA | 6ms | 3824kb | C++20 | 964b | 2024-09-01 16:52:49 | 2024-09-01 16:52:51 |
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;
}
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 || (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;
}
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int t;
cin >> t;
for (; t; t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3620kb
input:
1 5 10 13 450 585 465
output:
0 TAKE 0 TAKE 0 TAKE 3 1 2 3 TAKE 0 IGNORE
result:
ok OK, worst = 0.623667 (1 test case)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
1 1 100
output:
0 TAKE
result:
ok OK, worst = 1.000000 (1 test case)
Test #3:
score: -100
Wrong Answer
time: 6ms
memory: 3824kb
input:
2000 5 535 529 471 0 0 5 536 588 464 0 0 5 558 515 485 0 0 5 525 599 475 0 0 5 507 549 493 0 0 5 561 567 439 0 0 5 504 557 496 0 0 5 596 592 408 0 0 5 503 549 497 0 0 5 549 536 464 0 0 5 590 572 428 0 0 5 589 540 460 0 0 5 544 524 476 0 0 5 553 545 455 0 0 5 555 543 457 0 0 5 523 571 477 0 0 5 577 5...
output:
0 TAKE 0 IGNORE 0 IGNORE 0 IGNORE 0 IGNORE 0 TAKE 1 1 TAKE 0 IGNORE 0 IGNORE 0 IGNORE 0 TAKE 0 IGNORE 0 IGNORE 0 IGNORE 0 IGNORE 0 TAKE 1 1 TAKE 0 IGNORE 0 IGNORE 0 IGNORE 0 TAKE 1 1 TAKE 0 IGNORE 0 IGNORE 0 IGNORE 0 TAKE 1 1 TAKE 0 IGNORE 0 IGNORE 0 IGNORE 0 TAKE 1 1 ...
result:
wrong answer alg = 535 opt = 1000 (test case 1)