Submission #8589071


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
int getrandmax() {
	static uint32_t y = time(NULL);
	y ^= (y << 13); y ^= (y >> 17);
	y ^= (y << 5);
	return abs((int)y);
}
int getrand(int l, int r) { // [l, r]
	return getrandmax() % (r - l + 1) + l;
}
vector<int> makePermutation(int n) {
	vector<int> v(n);
	rep(i, 0, n) v[i] = i + 1;
	rep(i, 0, n) {
		int j = getrand(0, n - 1);
		swap(v[i], v[j]);
	}
	return v;
}
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N;
char ans[201];
//---------------------------------------------------------------------------------------------------
string ask(vector<int> d) {
	printf("?");
	fore(i, d) printf(" %d", i+1);
	printf("\n");
	fflush(stdout);

	string res; cin >> res;
	return res;
}
string ask2(int st) {
	vector<int> v;
	rep(i, 0, N) v.push_back((st + i) % (2 * N));
	return ask(v);
}
void answer() {
	printf("! ");
	rep(i, 0, N * 2) printf("%c", ans[i]);
	printf("\n");
}
//---------------------------------------------------------------------------------------------------
#define blue 'B'
#define red 'R'
void _main() {
	cin >> N;
	rep(i, 0, 2 * N) ans[i] = '#';

	int a = 0, b = N;
	string as = ask2(a), bs = ask2(b);
	while (a + 1 != b) {
		int md = (a + b) / 2;
		if (ask2(md) == as) a = md;
		else b = md;
	}

	if (as == "Red") {
		ans[a] = 'R';
		ans[(a + N) % (2 * N)] = 'B';
	}
	else {
		ans[a] = 'B';
		ans[(a + N) % (2 * N)] = 'R';
	}

	rep(st, 0, N - 1) {
		vector<int> v;
		rep(i, 0, N - 1) v.push_back((a + 1 + i) % (2 * N));
		v.push_back((a + N + 1 + st) % (2 * N));
		auto res = ask(v);
		if (res == "Red") ans[(a + N + 1 + st) % (2 * N)] = 'R';
		else ans[(a + N + 1 + st) % (2 * N)] = 'B';
	}

	rep(st, 0, N - 1) {
		vector<int> v;
		rep(i, 0, N - 1) v.push_back((a + 1 + N + i) % (2 * N));
		v.push_back((a + 1 + st) % (2 * N));
		auto res = ask(v);
		if (res == "Red") ans[(a + 1 + st) % (2 * N)] = 'R';
		else ans[(a + 1 + st) % (2 * N)] = 'B';
	}

	answer();
}





Submission Info

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

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt
All 800 / 800 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 3 ms 724 KB
in02.txt 3 ms 588 KB
in03.txt 3 ms 592 KB
in04.txt 4 ms 724 KB
in05.txt 3 ms 720 KB
in06.txt 3 ms 596 KB
in07.txt 3 ms 592 KB
in08.txt 3 ms 592 KB
in09.txt 4 ms 720 KB
in10.txt 4 ms 724 KB
in11.txt 4 ms 724 KB
in12.txt 3 ms 588 KB
in13.txt 4 ms 720 KB
in14.txt 4 ms 720 KB
in15.txt 4 ms 720 KB
in16.txt 4 ms 724 KB
in17.txt 3 ms 720 KB
in18.txt 4 ms 720 KB
in19.txt 4 ms 724 KB
in20.txt 4 ms 720 KB
in21.txt 4 ms 720 KB
in22.txt 4 ms 720 KB
in23.txt 19 ms 716 KB
in24.txt 18 ms 592 KB
in25.txt 19 ms 720 KB
in26.txt 18 ms 596 KB
in27.txt 20 ms 716 KB
in28.txt 19 ms 724 KB
in29.txt 20 ms 720 KB
in30.txt 19 ms 720 KB
in31.txt 18 ms 724 KB
in32.txt 20 ms 720 KB
in33.txt 19 ms 724 KB
in34.txt 19 ms 720 KB
in35.txt 19 ms 716 KB
in36.txt 19 ms 592 KB
in37.txt 19 ms 724 KB
in38.txt 20 ms 720 KB
in39.txt 18 ms 592 KB
in40.txt 19 ms 724 KB
in41.txt 19 ms 720 KB
in42.txt 18 ms 596 KB
in43.txt 18 ms 724 KB
in44.txt 18 ms 724 KB
in45.txt 18 ms 720 KB
in46.txt 18 ms 592 KB
in47.txt 19 ms 724 KB
in48.txt 18 ms 720 KB
in49.txt 18 ms 720 KB
in50.txt 19 ms 720 KB
in51.txt 18 ms 592 KB
in52.txt 18 ms 596 KB
in53.txt 19 ms 716 KB
in54.txt 19 ms 592 KB
in55.txt 18 ms 592 KB
in56.txt 19 ms 720 KB
in57.txt 18 ms 720 KB
in58.txt 19 ms 720 KB
in59.txt 4 ms 716 KB
in60.txt 4 ms 720 KB
in61.txt 5 ms 720 KB
in62.txt 7 ms 592 KB
in63.txt 12 ms 720 KB
in64.txt 17 ms 720 KB
sample_01.txt 3 ms 716 KB