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 <bits/stdc++.h>
using namespace std;
int press(string p);
string guess_sequence(int N)
{
string s;
int f=press("AB");
if (f==0)
{
if (press("X")==0) s="Y";
else s="X";
}
else
{
if (press("A")==0) s="B";
else s="A";
}
if (s[0]=='A')
for (int i=1; i<N-1; i++)
{
int check=press(s+"B"+s+"XB"+s+"XX"+s+"XY");
if (check==i) s+='Y';
else if (check==i+1) s+='B';
else s+="X";
}
else if (s[0]=='B')
for (int i=1; i<N-1; i++)
{
int check=press(s+"A"+s+"XA"+s+"XX"+s+"XY");
if (check==i) s+='Y';
else if (check==i+1) s+='A';
else s+="X";
}
else if (s[0]=='X')
for (int i=1; i<N-1; i++)
{
int check=press(s+"A"+s+"BA"+s+"BB"+s+"BY");
if (check==i) s+='Y';
else if (check==i+1) s+='A';
else s+="B";
}
else
for (int i=1; i<N-1; i++)
{
int check=press(s+"A"+s+"BA"+s+"BB"+s+"BX");
if (check==i) s+='X';
else if (check==i+1) s+='A';
else s+="B";
}
int l=press(s+"AB");
if (l<N)
{
if (press(s+"X")<N) s+="Y";
else s+="X";
}
else
{
if (press(s+"A")<N) s+="B";
else s+="A";
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |