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;
std::string guess_sequence(int N) {
string S = "";
int ans = 0;
string a, b, c;
if(press("AB") >0)
{
if(press("A") == 1)
{
S = "A"; a = "B"; b = "X"; c = "Y";
}
else
{
S= "B"; a = "A"; b = "X"; c = "Y";
}
}
else
{
if(press("X") > 0)
{
S = "X"; a = "B"; b = "A"; c = "Y";
}
else
{
S = "Y"; a = "B"; b = "X"; c = "A";
}
}
string guess = "";
for(int i = 1; i <= N-2; i ++)
{
guess = S + a + b + S + a + c + S + a + a + S + b;
ans = press(guess);
if(ans == i)
{
S = S + c;
}
else if (ans == i + 1)
{
S = S + b;
}
else
{
S = S + a;
}
}
guess = S + a;
if(press(guess) == N)
{
S = S + a;
}
else
{
guess = S + b;
if(press(guess) == N)
{
S = S + b;
}
else
{
S = S + c;
}
}
//cout << S;
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |