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 S="";
char a='A',b='B',x='X',y='Y';
S+=a;
S+=b;
if(press(S))
{
S="";
S+=a;
if(!press(S))
swap(b,a);
}
else
{
S="";
S+=x;
if(press(S))
swap(a,x);
else
swap(a,y);
}
string rez="";
rez+=a;
for(int i=2; i<n; i++)
{
S=rez;
S+=b;
S+=rez;
S+=x;
S+=b;
S+=rez;
S+=x;
S+=x;
S+=rez;
S+=x;
S+=y;
int val=press(S);
if(val==i)
rez+=b;
else if(val==i+1)
rez+=x;
else
rez+=y;
}
if(n>1)
{
S=rez;
S+=b;
S+=rez;
S+=x;
if(press(S)==n)
{
S=rez;
S+=b;
if(press(S)==n)
rez+=b;
else
rez+=x;
}
else
rez+=y;
}
return rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |