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 = "", temp;
string l;
int i, v, j;
v = press("AB");
if (v)
{
v = press("A");
if (v)
{
s = "A";
l = "BXY";
}
else
{
s = "B";
l = "AXY";
}
}
else
{
v = press("X");
if (v)
{
s = "X";
l = "ABY";
}
else
{
s = "Y";
l = "ABX";
}
}
for (i = 2; i<N; i++)
{
temp = s + l[0];
for (j = 0; j<3; j++)
temp = temp + s + l[1] + l[j];
v = press(temp);
if (v == i-1)
s = s + l[2];
else if (v == i)
s = s + l[0];
else
s = s + l[1];
}
if (N > 1)
{
for (j = 0; j<2; j++)
{
temp = s + l[j];
v = press(temp);
if (v == i)
{
s = s + l[j];
break;
}
}
if (j == 2)
s = s + l[j];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |