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)
{
int r = press("AB");
vector <char> opt;
string sir;
if (r == 0)
{
r = press ("X");
opt.push_back('A');
opt.push_back('B');
if (r == 1)
{
sir+="X";
opt.push_back('Y');
}
else
{
sir += "Y";
opt.push_back('X');
}
}
else
{
r = press ("A");
opt.push_back('X');
opt.push_back('Y');
if (r == 1)
{
sir+="A";
opt.push_back('B');
}
else
{
sir += "B";
opt.push_back('A');
}
}
for (int pas = 2; pas < n; pas++)
{
string ask = sir + opt[0] + opt[0] + sir + opt[0] + opt[1] + sir + opt[0] + opt[2] + sir + opt[1];
r = press(ask);
if (r == pas + 1)
sir += opt[0];
else if (r == pas)
sir += opt[1];
else sir += opt[2];
}
string ask = sir + opt[0] + sir + opt[1];
r = press(ask);
if (r == n)
{
ask = sir + opt[0];
r = press(ask);
if (r == n)
sir += opt[0];
else sir += opt[1];
}
else sir += opt[2];
return sir;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |