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 "bits/stdc++.h"
using namespace std;
char c[4]={'A', 'B', 'X', 'Y'};
int f, cnt=1;
inline int r(int x)
{
return (f+x)%4;
}
string guess_sequence(int n)
{
string s;
if(press("AB"))
{
if(press("A")) f=0, s+='A';
else f=1, s+='B';
}
else
{
if(press("X")) f=2, s+='X';
else f=3, s+='Y';
}
while(cnt<n-1)
{
int x=press(s+c[r(1)] + s+c[r(2)]+c[r(1)] + s+c[r(2)]+c[r(2)] + s+c[r(2)]+c[r(3)]);
if(x==cnt) s+=c[r(3)];
else if(x==cnt+1) s+=c[r(1)];
else s+=c[r(2)];
cnt++;
}
if(n!=1)
{
if(press(s+c[r(2)])==n) s+=c[r(2)];
else if(press(s+c[r(1)])==n) s+=c[r(1)];
else s+=c[r(3)];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |