Contest Duration: - (local time) (100 minutes) Back to Home

Submission #8584531

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod

cout << "?";
for(int x: A) cout << " " << x + 1;
cout << endl;
}

signed main(){

int N; cin >> N;

vec res(2 * N, 0), ans(2 * N, 0);
int i1 = 0, i2 = N;
vec a(N);
REP(i, N) a[i] = i;
string T; cin >> T;
if(T == "Red") res[0] = 1;
else res[0] = -1;
res[N] = -res[0];
while(i2 - i1 > 1){
int im = (i1 + i2) / 2;
REP(i, N) a[i] = im + i;
cin >> T;
if(T == "Red") res[im] = 1;
else res[im] = -1;

if(res[im] == res[i1]) i1 = im;
else i2 = im;
}
int i0 = i1;
ans[i0] = res[i0];
ans[i0 + N] = res[i0 + 1];

//debug(i0);
vec A;
REP(i, 2 * N) if(i < i0 || i > i0 + N) A.pb(i);
A.pb(-1);
FOR(i, i0 + 1, i0 + N){
A[N - 1] = i;
cin >> T;
if(T == "Red") ans[i] = 1;
else ans[i] = -1;
}

A.resize(0);
FOR(i, i0 + 1, i0 + N) A.pb(i);
A.pb(-1);
FOR(i, 0, 2 * N) if(i < i0 || i > i0 + N){
A[N - 1] = i;
cin >> T;
if(T == "Red") ans[i] = 1;
else ans[i] = -1;
}

string x = "";
REP(i, 2 * N){
if(ans[i] == 1) x += 'R';
else x += 'B';
}
cout << "! " << x << endl;

return 0;
}
```

#### Submission Info

Submission Time 2019-11-23 22:23:27+0900 E - Majority of Balls sumitacchan C++14 (GCC 5.4.1) 800 4162 Byte AC 19 ms 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 720 KB
in03.txt AC 3 ms 720 KB
in04.txt AC 3 ms 592 KB
in05.txt AC 3 ms 724 KB
in06.txt AC 3 ms 724 KB
in07.txt AC 3 ms 716 KB
in08.txt AC 3 ms 720 KB
in09.txt AC 3 ms 724 KB
in10.txt AC 3 ms 720 KB
in11.txt AC 3 ms 720 KB
in12.txt AC 3 ms 720 KB
in13.txt AC 3 ms 720 KB
in14.txt AC 3 ms 724 KB
in15.txt AC 3 ms 720 KB
in16.txt AC 3 ms 592 KB
in17.txt AC 3 ms 720 KB
in18.txt AC 3 ms 716 KB
in19.txt AC 3 ms 716 KB
in20.txt AC 3 ms 628 KB
in21.txt AC 3 ms 632 KB
in22.txt AC 3 ms 720 KB
in23.txt AC 18 ms 620 KB
in24.txt AC 18 ms 720 KB
in25.txt AC 17 ms 596 KB
in26.txt AC 18 ms 596 KB
in27.txt AC 18 ms 720 KB
in28.txt AC 18 ms 596 KB
in29.txt AC 17 ms 720 KB
in30.txt AC 18 ms 624 KB
in31.txt AC 18 ms 724 KB
in32.txt AC 18 ms 724 KB
in33.txt AC 18 ms 724 KB
in34.txt AC 18 ms 720 KB
in35.txt AC 18 ms 592 KB
in36.txt AC 18 ms 720 KB
in37.txt AC 18 ms 724 KB
in38.txt AC 19 ms 720 KB
in39.txt AC 18 ms 592 KB
in40.txt AC 19 ms 724 KB
in41.txt AC 18 ms 720 KB
in42.txt AC 19 ms 720 KB
in43.txt AC 17 ms 724 KB
in44.txt AC 17 ms 716 KB
in45.txt AC 18 ms 720 KB
in46.txt AC 18 ms 592 KB
in47.txt AC 17 ms 592 KB
in48.txt AC 17 ms 720 KB
in49.txt AC 17 ms 724 KB
in50.txt AC 17 ms 716 KB
in51.txt AC 17 ms 720 KB
in52.txt AC 17 ms 596 KB
in53.txt AC 18 ms 596 KB
in54.txt AC 18 ms 724 KB
in55.txt AC 18 ms 716 KB
in56.txt AC 17 ms 720 KB
in57.txt AC 18 ms 592 KB
in58.txt AC 18 ms 620 KB
in59.txt AC 3 ms 720 KB
in60.txt AC 4 ms 716 KB
in61.txt AC 4 ms 724 KB
in62.txt AC 7 ms 720 KB
in63.txt AC 11 ms 720 KB
in64.txt AC 15 ms 592 KB
sample_01.txt AC 3 ms 628 KB