QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#64156#993. 100 Boxes Per Hour...feecle6418#TL 0ms0kbC++141.7kb2022-11-24 10:32:372022-11-24 10:32:39

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-24 10:32:39]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 0kb
  • [2022-11-24 10:32:37]
  • Submitted

answer

#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;
			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;
		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;
					cur1=x,s1=1;
				}
				else {
					cout<<"EMPTY "<<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;
						cur1=x,s1=1;
					}
					else {
						cout<<"EMPTY "<<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();
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

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

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: