# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
802414 | Gabi88 | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
/*
int press(string a){
int x; cout << a << endl; cin >> x; return x;
}*/
string guess_sequence(int n){
string s;
vector<char> v;
int t = press("AB");
int pos = 2;
if (t > 0){
t = press("A");
if (t == 1){ s = "A"; v.push_back('B'); v.push_back('X'); v.push_back('Y');}
else{ s = "B"; v.push_back('A'); v.push_back('X'); v.push_back('Y'); }
}else{
t = press("X");
if (t == 1){ s = "X"; v.push_back('A'); v.push_back('B'); v.push_back('Y'); }
else{ s = "Y"; v.push_back('A'); v.push_back('B'); v.push_back('X'); }
}
while(pos < n){
t = press(s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2]);
if (t == pos-1) s += v[2];
else if (t == pos) s += v[0];
else s += v[1];
pos++;
}
for(int i=0; i<2; i++){
t = press(s+v[i]);
if (t == pos){ pos++; s += v[i]; }
}
if (pos == n) s += v[2];
return s;
}/*
int main(){
int n; cin >> n; cout << "-> " << guess_sequence(n) << endl;
}*/