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"
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
string s="",p="",a;
int c,k;
p = "AB";
c = press(p);
if(c == 2)
{
k = 2;
s = p;
}
else if(c == 1)
{
if(press("A") == 1)s = "A";
else s = "B";
k = 1;
}
else
{
if(press("Y") == 1)s = "Y";
else s = "X";
k = 1;
}
a[0] = s[0];
if(a[0] == 'A')
{
a[1] = 'B';a[2] = 'X';a[3] = 'Y';
}
else if(a[0] == 'B')
{
a[1] = 'A';a[2] = 'X';a[3] = 'Y';
}
else if(a[0] == 'X')
{
a[1] = 'B';a[2] = 'A';a[3] = 'Y';
}
else if(a[0] == 'Y')
{
a[1] = 'B';a[2] = 'X';a[3] = 'A';
}
for(;k < n-1;k++)
{
p = s + a[1] + a[2] + s + a[1] + a[3] + s + a[1] + a[1] + s + a[2];
c = press(p);
if(c == k + 2)s = s + a[1];
else if(c == k + 1)s = s + a[2];
else s = s + a[3];
}
p = s + a[1] + s + a[2];
c = press(p);
if(c == k + 1)
{
p = s + a[1];
if(press(p) == k + 1)s = s + a[1];
else s = s + a[2];
}
else s = s + a[3];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |