#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
using str = string;
str CHARS[4] = {"A", "B", "X", "Y"};
#define rep(x) for (auto &x : CHARS)
#define each(x, a) for (auto &x : a)
str guess_sequence(int N) {
str fst = "A";
for (int i = 1; i <= 3; i++) {
if (press(CHARS[i]) == 1) {
fst = CHARS[i];
break;
}
}
vector<string> nchars; for (int i = 0; i < 4; i++) if (CHARS[i] != fst) nchars.push_back(CHARS[i]);
str pref = fst;
for (int i = 1; i < N; i++) {
bool found = false;
for (int k = 0; k <= 1; k++) {
if (press(pref + nchars[k]) == pref.size()) continue;
found = true;
pref += nchars[k];
break;
}
if (found == false) pref += nchars[2];
}
return pref;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |