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"
#include <cstdio>
char btn[]="ABXY";
std::string guess_sequence(int N) {
std::string p = "";
int first=0;
first |= !!press("BY");
first |= !!press("XY")<<1;
std::string poss="";
for(int i=0;i<4;++i)
if(i!=first)
poss.push_back(btn[i]);
std::string S = "";
S += btn[first];
for(int i=1;i+1<N;++i)
{
p="";
p += (S+poss[1]);
p += (S+poss[2]+poss[0]);
p += (S+poss[2]+poss[1]);
p += (S+poss[2]+poss[2]);
S += poss[press(p)-i];
}
if(N>1)
{
int last=0;
for(;last<2;++last)
if(press(S+poss[last])==N)
break;
S += poss[last];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |