# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874892 | tuannm | Combo (IOI18_combo) | C++17 | 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;
string guess_sequence(int N){
int x;
string s;
char c[4] = {'A', 'B', 'X', 'Y'};
if(press("AB") >= 1){
x = (press("A") != 1);
}
else
x = 2 + (press("X") < 1);
s += c[x];
if(N == 1)
return s;
swap(c[x], c[3]);
for(int i = 1; i < N - 1; ++i){
x = press(s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1]);
if(x == i + 2)
s += c[0];
else if(x == i + 1)
s += c[1];
else
s += c[2];
}
if(press(s + c[0] + s + c[1]) == N){
if(press(s + c[0]) == N)
s += c[0];
else
s += c[1];
}
else s += c[2];
return s;
}