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="A";
if (press("AB")) {
if (press("B")) S="B";
} else {
if (press("X")) S="X";
else S="Y";
}
if (N==1) return S;
vector<char> possible;
if (S!="A") possible.push_back('A');
if (S!="B") possible.push_back('B');
if (S!="X") possible.push_back('X');
if (S!="Y") possible.push_back('Y');
for (int i = 2; i < N; ++i)
{
string verif=S+possible[0];
int taille=press(verif+possible[0]+verif+possible[1]+verif+possible[2]+S+possible[1]);
if (taille>=i+1)
{
S+=possible[0];
}
else if(taille==i) {
S+=possible[1];
}
else {
S+=possible[2];
}
}
if (press(S+possible[0]+S+possible[1])==N)
{
if (press(S+possible[0])==N) S+=possible[0];
else S+=possible[1];
}
else {
S+=possible[2];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |