QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#654509 | #9178. All-You-Can-Eat | woodie_0064# | WA | 1ms | 3552kb | C++20 | 1.3kb | 2024-10-18 21:42:33 | 2024-10-18 21:42:34 |
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;
continue;
}
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){
big = cake[i], s += cake[i], idd = i;
vector<int> erasse;
while(s > 1000){
s -= cake[have.back()];
erasse.push_back(have.back());
have.pop_back();
}
cout << erasse.size();
for(auto x : erasse) cout << " " << x;
cout << "\nTAKE\n" << flush;
}else if(cake[i] < big){
cout << "1 " << idd << "\nTAKE\n" << flush;
s = s - big + cake[i], idd = i;
big = cake[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: 3552kb
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)