# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144644 | aanji | 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.
string guess_sequence(int N)
{
string s;
char a='A', b='B', c='X';
if(press("AB")) {
if(press("A")) {
s="A";
a='Y';
}
else {
b='Y';
s="B";
}
}
else {
if(press("X")) {
c='Y';
s="X";
}
else s="Y";
}
while(s.size()<N-1) {
int k=press(s+a+s+b+a+s+b+b+s+b+c);
if(k==s.size()) s+=c;
else if(k==s.size()+1) s+=a;
else s+=b;
}
if(press(s+a)==s.size()+1) return s+a;
if(press(s+b)==s.size()+1) return s+b;
return s+c;
}