QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#341038#993. 100 Boxes Per Hour...ucup-team1209AC ✓7ms3544kbC++202.0kb2024-02-29 15:08:102024-02-29 15:08:11

Judging History

你现在查看的是测评时间为 2024-02-29 15:08:11 的历史记录

  • [2024-02-29 16:30:52]
  • 管理员手动重测该提交记录
  • 测评结果:AC
  • 用时:37ms
  • 内存:3744kb
  • [2024-02-29 15:08:11]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:3544kb
  • [2024-02-29 15:08:10]
  • 提交

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