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;
#include "combo.h"
std::string guess_sequence(int N) {
string S,a,b,c;
if (press("AB")>=1){
if(press("A")==1)S="A",a="B",b="X",c="Y";
else S="B",a="A",b="X",c="Y";
}else{
if(press("X")==1)S="X",a="A",b="B",c="Y";
else S="Y",a="A",b="B",c="X";
}
for (int i=1;i<N-1;i++){
string p=S+a+S+b+a+S+b+b+S+b+c;
int X=press(p);
if (X==i)S+=c;
else if(X==i+1)S+=a;
else S+=b;
}
if(N>1){
if (press(S+a+S+b)==N){
if (press(S+a)==N)S+=a;else S+=b;
}else S+=c;
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |