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"
std::string guess_sequence(int N)
{
std::string start;
std::string buttons[3];
buttons[0]="A";
buttons[1]="B";
buttons[2]="X";
std::string ans="";
std::string query="";
if(press("AB")>0)
{
if(press("A")>0)
{
start="A";
}
else
{
start="B";
}
}
else
{
if(press("X")>0)
{
start="X";
}
else
{
start="Y";
}
}
if("A"==start)
{
buttons[0]="B";
buttons[1]="X";
buttons[2]="Y";
}
if("B"==start)
{
buttons[0]="A";
buttons[1]="X";
buttons[2]="Y";
}
if("X"==start)
{
buttons[0]="A";
buttons[1]="B";
buttons[2]="Y";
}
if("Y"==start)
{
buttons[0]="A";
buttons[1]="B";
buttons[2]="X";
}
//cout << start << ' ' << buttons[0] << ' ' << buttons[1] << ' ' << buttons[2] << endl;
ans=start;
for(int i=1;i<N-1;i++)
{
query=ans;
query+=buttons[0];
query+=buttons[0];
query+=ans;
query+=buttons[0];
query+=buttons[1];
query+=ans;
query+=buttons[0];
query+=buttons[2];
query+=ans;
query+=buttons[1];
//cout << query << endl;
int res=press(query);
if(res==i)
{
ans+=buttons[2];
}
if(res==i+1)
{
ans+=buttons[1];
}
if(res==i+2)
{
ans+=buttons[0];
}
}
if(press(ans+buttons[0])==N)
{
ans+=buttons[0];
}
else if(press(ans+buttons[1])==N)
{
ans+=buttons[1];
}
else
{
ans+=buttons[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |