#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string seq;
string a = "A", b = "B", x = "X", y = "Y";
if (press(a + b)) {
if (press(a)) {
seq += a;
a = y;
}
else {
seq += b;
b = y;
}
}
else {
if (press(x)) {
seq += x;
x = y;
}
else {
seq += y;
}
}
for (int i = 2; i < N; ++i) {
int resa = press(seq + a);
int resb = press(seq + b);
int resx = press(seq + x);
if (resa == i) {
seq += a;
}
else if (resb == i) {
seq += b;
}
else {
seq += x;
}
}
if (N > 1) {
if (press(seq + a) == N) {
seq += a;
}
else if (press(seq + b) == N) {
seq += b;
}
else {
seq += x;
}
}
return seq;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |