#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
string f;
if (press("AB")) {
if (press("A")) {
f = "A";
} else {
f = "B";
}
} else {
if (press("X")) {
f = "X";
} else {
f = "Y";
}
}
string g = "ABXY";
g.erase(g.begin() + g.find(f));
if (N >= 2) {
for (int i = 0; i < N - 2; i++) {
string cur = f + g[1] + f + g[0] + g[1] + f + g[0] + g[0] + f + g[0] + g[2];
int x = press(cur);
if (x == f.size() + 1) {
f += g[1];
} else if (x == f.size() + 2) {
f += g[0];
} else {
f += g[2];
}
}
string cur = f + g[0] + f + g[1];
if (press(cur) > f.size()) {
string last = f + g[0];
if (press(last) > f.size()) {
f += g[0];
} else {
f += g[1];
}
} else {
f += g[2];
}
}
return f;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |