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<bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
string s, c = "ABXY";
int f, x;
f = press("AB");
if(f > 0)
{
x = press("A");
if(x > 0)
s = "A";
else
s = "B";
}
else
{
x = press("X");
if(x > 0)
s = "X";
else
s = "Y";
}
f = 1;
c.erase(c.find(s), 1);
for(int i = 1; i < n-1; i ++)
{
//cout << f << " " << s << " // ";
string v = s + c[1] + s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2];
x = press(v);
if(x == f)
{
s += c[2];
f = x + 1;
continue;
}
if(x - f == 1)
{
s += c[1];
f = x;
continue;
}
s += c[0];
f = x-1;
}
x = press(s + c[0]);
if(x == n)
return s+c[0];
x = press(s + c[1]);
if(x == n)
return s+c[1];
return s+c[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |