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 < min(N, 3); i++) {
if (press(S+lista[0]) == i+1) S += lista[0];
else if (press(S+lista[1]) == i+1) S += lista[1];
else S += lista[2];
}
for (int i = 3; i < N; i++) {
int xd = press(S+lista[0]+S+lista[1]+lista[0]+S+lista[1]+lista[2]);
if (xd == i) {
S += lista[2];
} else if (xd == i+1) {
S += lista[0];
} else {
S += lista[1];
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |