#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string ans;
int first = press("AB");
if (first == 2) ans += 'A';
else if (first == 1) ans += (press("A") == 1 ? 'A' : 'B');
else ans += (press("X") == 1 ? 'X' : 'Y');
for (int i = 1; i < N; i++) {
string st = ans + 'A' + ans + 'B';
int choose = press(st);
if (choose == ans.length() + 1) {
int a = press(ans+'A');
if (a == ans.length()) ans += 'B';
else ans += 'A';
} else {
int x = press(ans+'X');
if (x == ans.length()) ans += 'Y';
else ans += 'X';
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |