QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#654463 | #9178. All-You-Can-Eat | woodie_0064# | WA | 1ms | 3764kb | C++20 | 1.0kb | 2024-10-18 21:36:43 | 2024-10-18 21:36:47 |
Judging History
answer
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 1e5 + 3;
int T;
int n, num;
void work(){
cin >> n;
int p = 0; vector<int> cake(n+1);
vector<int> have; int s = 0, big = 0, idd = 0;
for(int i = 1; i <= n; ++i){
cin >> cake[i];
if(p) cout << "0\nIGNORE\n" << flush;
if(cake[i] >= 600){
cout << have.size() << " ";
for(auto x : have) cout << x << " ";
cout << "\nTAKE\n" << flush;
p = 1;
}else if(cake[i] <= 400){
cout << "0\nTAKE\n" << flush;
s += cake[i];
have.push_back(i);
}else{
if(!big){
cout << "0\nTAKE\n" << flush;
big = cake[i], s += cake[i], idd = i;
}else if(cake[i] < big){
cout << "1 " << idd << "\nTAKE\n" << flush;
s = s - big + cake[i], idd = i;
}else{
cout << "0\nIGNORE\n" << flush;
}
}
if(s >= 600) p = 1;
}
}
int main(){
// freopen("test.txt", "r", stdin);
// ios::sync_with_stdio(false);
// cin.tie(0);
int T = 1;
cin >> T;
while(T--){
work();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3764kb
input:
1 5 10 13 450 585 465
output:
0 TAKE 0 TAKE 0 TAKE 0 IGNORE 0 IGNORE
result:
wrong answer alg = 473 opt = 938 (test case 1)