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;
std::string guess_sequence(int N)
{
//cout << N << endl;
string s = "";
string c = "ABXY";
if(press("AB"))
{
if(press("A"))
{
s += 'A';
c = "BXY";
}
else
{
s += 'B';
c = "AXY";
}
}
else
{
if(press("X"))
{
s += 'X';
c = "ABY";
}
else
{
s += 'Y';
c = "ABX";
}
}
for(int i = 1; i < N-1; i++)
{
//cout << i << endl;
int p = press(s+c[1]+s+c[2]+c[0]+s+c[2]+c[1]+s+c[2]+c[2]);
if(p == i)
s += c[0];
if(p == i+1)
s += c[1];
if(p == i+2)
s += c[2];
}
string ask1 = s;ask1+=c[0];
string ask2 = s;ask2+=c[1];
string ask3 = s;ask3+=c[2];
if(press(ask1) == N)s = ask1;
else if(press(ask2) == N)s = ask2;
else s = ask3;
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |