#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
// #define int long long
string guess_sequence(int n) {
string p;
set<string> st;
st.insert("A"); st.insert("B");
st.insert("X"); st.insert("Y");
int c = press("AB");
if (c >= 1) {
c = press("A");
if (c == 1) p = "A";
else p = "B";
} else {
c = press("X");
if (c == 1) p = "X";
else p = "Y";
}
if (n == 1) return p;
string b, x, y;
c = 0;
for (auto i : st) {
if (i == p) continue;
if (c == 0) b = i;
else if (c == 1) x = i;
else y = i;
++c;
}
int cnt = 1;
for (int i = 1; i < n - 1; ++i) {
string t = p + b + p + x + y + p + x + x + p + x + b;
c = press(t);
if (c == cnt) p += y;
else if (c == cnt + 1) p += b;
else p += x;
cnt++;
}
c = press(p + b);
if (c == n) {
p += b;
}
else {
c = press(p + x);
if (c == n) p += x;
else p += y;
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |