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