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 "combo.h"
using namespace std;
string guess_sequence(int N){
char cc[4]= {'A','B','X','Y'};
char c[3];
string S="";
if(press("AB")){
if(press("A"))S="A";
else S="B";
}else{
if(press("X"))S="X";
else S="Y";
}
int cnt=0;
for(int i=0;i<4;++i){
if(cc[i]==S[0])continue;
c[cnt++]=cc[i];
}
if(N==1)return S;
for (int i = 1; i < N-1; ++i){
string tmp=S+c[1];
for(int j=0;j<3;++j){
tmp+=S+c[2]+c[j];
}
S+=c[press(tmp)-i];
}
if(press(S+"A"+S+"B")==N){
if(press(S+"A")==N)S+="A";
else S+="B";
}else{
if(press(S+"X")==N)S+="X";
else S+="Y";
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |