QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#543579 | #9178. All-You-Can-Eat | nekoyellow | WA | 1ms | 3504kb | C++20 | 1.4kb | 2024-09-01 17:18:55 | 2024-09-01 17:18:55 |
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) {
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)