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)
{
string ans="";
char first;
char P[3];
if(press("AB")>0)
{
if(press("A")>0)
first='A';
else
first='B';
}
else
{
if(press("X")>0)
first='X';
else
first='Y';
}
ans=ans+first;
if(first=='A')
{
P[0]='B';
P[1]='X';
P[2]='Y';
}
else if(first=='B')
{
P[0]='A';
P[1]='X';
P[2]='Y';
}
else if(first=='X')
{
P[0]='A';
P[1]='B';
P[2]='Y';
}
else
{
P[0]='A';
P[1]='B';
P[2]='X';
}
int i,X;
for(i=2;i<N;i++)
{
X=press(ans+P[0]+P[0]+ans+P[0]+P[1]+ans+P[0]+P[2]+ans+P[1]);
if(X>i)
ans=ans+P[0];
else if(X==i)
ans=ans+P[1];
else
ans=ans+P[2];
}
if(N>1)
{
if(press(ans+P[0])==N)
ans=ans+P[0];
else if(press(ans+P[1])==N)
ans=ans+P[1];
else
ans=ans+P[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |