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 <string>
using namespace std;
string guess_sequence(int n)
{
string s, t;
int i, er = press("AB"), se = press("AX");
if (er > 0)
{
if (se > 0)
t = "ABXY";
else
t = "BXYA";
}
else
{
if (se > 0)
t = "XYAB";
else
t = "YABX";
}
s = t[0];
if (n == 1)
return s;
for (i = 2; i < n; i++)
{
er = press(s + t[1] + s + t[2] + t[1] + s + t[2] + t[2] + s + t[2] + t[3]);
if (er == i)
s += t[1];
else if (er == i + 1)
s += t[2];
else
s += t[3];
}
er = press(s + t[1]);
se = press(s + t[2]);
if (er == n)
s += t[1];
else if (se == n)
s += t[2];
else
s += t[3];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |