Submission #8592442


Source Code Expand

Copy
#include "bits/stdc++.h"
using namespace std;

int N,RB='R'+'B';

string reply;
char getreply(){
	cin >> reply;
	return reply[0];
}

void sendquestion(int s){
	int i;
	cout << "?";
	for(i=0; i<N; ++i){
		cout << " " << s+i;
	}
	cout << endl; cout.flush();
}

char c,ans[225];

int main(void){
	int i,j,p,l,r,m;
	cin >> N;
	l = 1; r = N+1;
	sendquestion(1); c = getreply();
	while(r-l>1){
		m = (l+r)/2;
		sendquestion(m);
		if(c == getreply()){
			l = m;
		}else{
			r = m;
		}
	}
	p = l;
	for(i=p; i<=p+N; ++i){
		cout << "?";
		for(j=p; j<=p+N; ++j){
			if(i==j){
				continue;
			}
			cout << " " << j;
		}
		cout << endl; cout.flush();
		ans[i-1] = RB-getreply();
	}
	for(i=1; i<=N*2; ++i){
		if(p<=i && i<=p+N){
			continue;
		}
		cout << "?";
		for(j=1; j<=p; ++j){
			if(i==j){
				continue;
			}
			cout << " " << j;
		}
		for(j=p+N; j<=N*2; ++j){
			if(i==j){
				continue;
			}
			cout << " " << j;
		}
		cout << endl; cout.flush();
		ans[i-1] = RB-getreply();
	}
	cout << "! ";
	for(i=0; i<N*2; ++i){
		cout << ans[i];
	}
	cout << endl; cout.flush();
	return 0;
}

Submission Info

Submission Time
Task E - Majority of Balls
User ransewhale
Language C++14 (GCC 5.4.1)
Score 800
Code Size 1150 Byte
Status AC
Exec Time 19 ms
Memory 724 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 800 / 800
Status
AC × 1
AC × 65
Set Name Test Cases
Sample sample_01.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt, in61.txt, in62.txt, in63.txt, in64.txt, sample_01.txt
Case Name Status Exec Time Memory
in01.txt AC 3 ms 720 KB
in02.txt AC 3 ms 688 KB
in03.txt AC 3 ms 720 KB
in04.txt AC 3 ms 716 KB
in05.txt AC 3 ms 688 KB
in06.txt AC 3 ms 716 KB
in07.txt AC 3 ms 720 KB
in08.txt AC 3 ms 720 KB
in09.txt AC 3 ms 688 KB
in10.txt AC 3 ms 652 KB
in11.txt AC 3 ms 720 KB
in12.txt AC 3 ms 720 KB
in13.txt AC 3 ms 724 KB
in14.txt AC 3 ms 720 KB
in15.txt AC 3 ms 720 KB
in16.txt AC 3 ms 688 KB
in17.txt AC 3 ms 720 KB
in18.txt AC 3 ms 720 KB
in19.txt AC 3 ms 652 KB
in20.txt AC 3 ms 652 KB
in21.txt AC 3 ms 688 KB
in22.txt AC 3 ms 688 KB
in23.txt AC 18 ms 720 KB
in24.txt AC 18 ms 720 KB
in25.txt AC 18 ms 720 KB
in26.txt AC 18 ms 720 KB
in27.txt AC 19 ms 720 KB
in28.txt AC 19 ms 716 KB
in29.txt AC 19 ms 716 KB
in30.txt AC 19 ms 688 KB
in31.txt AC 17 ms 688 KB
in32.txt AC 19 ms 716 KB
in33.txt AC 18 ms 592 KB
in34.txt AC 17 ms 720 KB
in35.txt AC 18 ms 716 KB
in36.txt AC 18 ms 720 KB
in37.txt AC 18 ms 720 KB
in38.txt AC 18 ms 720 KB
in39.txt AC 18 ms 720 KB
in40.txt AC 18 ms 716 KB
in41.txt AC 18 ms 688 KB
in42.txt AC 18 ms 648 KB
in43.txt AC 18 ms 596 KB
in44.txt AC 18 ms 592 KB
in45.txt AC 18 ms 724 KB
in46.txt AC 18 ms 720 KB
in47.txt AC 18 ms 592 KB
in48.txt AC 18 ms 720 KB
in49.txt AC 18 ms 652 KB
in50.txt AC 18 ms 720 KB
in51.txt AC 19 ms 720 KB
in52.txt AC 19 ms 720 KB
in53.txt AC 18 ms 720 KB
in54.txt AC 18 ms 720 KB
in55.txt AC 18 ms 720 KB
in56.txt AC 19 ms 720 KB
in57.txt AC 17 ms 720 KB
in58.txt AC 18 ms 720 KB
in59.txt AC 3 ms 720 KB
in60.txt AC 4 ms 720 KB
in61.txt AC 4 ms 716 KB
in62.txt AC 7 ms 720 KB
in63.txt AC 11 ms 724 KB
in64.txt AC 16 ms 716 KB
sample_01.txt AC 3 ms 720 KB