QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#341038 | #993. 100 Boxes Per Hour... | ucup-team1209 | AC ✓ | 7ms | 3544kb | C++20 | 2.0kb | 2024-02-29 15:08:10 | 2024-02-29 15:08:11 |
Judging History
answer
// by feecle6418#
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef array<int,7> S;
const int mod=998244353;
void Solve(){
int a[3]={0},cnt[3]={0},cur1=0,cur2=1,s1=0,s2=0;
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3,greater<int>());
if(a[1]+a[2]>=43){
for(int i=1;i<=100;i++){
char ch;
cin>>ch;
assert(ch=='R'||ch=='G'||ch=='B');
int x=(ch=='R'?0:(ch=='G'?1:2));
if(x==cur1)cout<<"PLACE "<<1<<endl;
else if(x==cur2)cout<<"PLACE "<<2<<endl;
else cout<<"DISCARD"<<endl;
}
return ;
}
bool hasdone=0;
for(int i=1;i<=100;i++){
char ch;
cin>>ch;
assert(ch=='R'||ch=='G'||ch=='B');
int x=(ch=='R'?0:(ch=='G'?1:2));
cnt[x]++;
if(cnt[x]==a[1]+1){
hasdone=1;
if(x==cur1||x==cur2){
if(x==cur1)cout<<"PLACE "<<1<<endl,s1++;
else if(x==cur2)cout<<"PLACE "<<2<<endl,s2++;
else cout<<"DISCARD"<<endl;
}
else {
if(s1<s2){
cout<<"EMPTY "<<1<<endl;
cout<<"PLACE "<<1<<endl;
cur1=x,s1=1;
}
else {
cout<<"EMPTY "<<2<<endl;
cout<<"PLACE "<<2<<endl;
cur2=x,s2=1;
}
}
}
else if(!hasdone){
if(x==cur1)cout<<"PLACE "<<1<<endl,s1++;
else if(x==cur2)cout<<"PLACE "<<2<<endl,s2++;
else cout<<"DISCARD"<<endl;
}
else {
if(a[2]>=a[1]-a[2]){
if(x==cur1)cout<<"PLACE "<<1<<endl,s1++;
else if(x==cur2)cout<<"PLACE "<<2<<endl,s2++;
else cout<<"DISCARD"<<endl;
}
else {
if(x!=cur1&&x!=cur2&&cnt[x]==a[2]+1&&min(s1,s2)<=a[2]){
if(s1<s2){
cout<<"EMPTY "<<1<<endl;
cout<<"PLACE "<<1<<endl;
cur1=x,s1=1;
}
else {
cout<<"EMPTY "<<2<<endl;
cout<<"PLACE "<<2<<endl;
cur2=x,s2=1;
}
}
else {
if(x==cur1)cout<<"PLACE "<<1<<endl,s1++;
else if(x==cur2)cout<<"PLACE "<<2<<endl,s2++;
else cout<<"DISCARD"<<endl;
}
}
}
}
}
int main(){
int t;
cin>>t;
while(t--)Solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 7ms
memory: 3544kb
input:
100 3 33 64 B G R R G R B R G R R B G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G R R G 84 8 8 B B B R R R R R G G G G G G G G B B B B B B B B B B B B R B B B B B B B B B B B B...
output:
DISCARD PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 DISCARD PLACE 1 PLACE 2 PLACE 1 PLACE 1 DISCARD PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLACE 1 PLACE 1 PLACE 2 PLAC...
result:
wrong answer ok OK