#include <bits/stdc++.h>
#include "combo.h"
// #include "grader.cpp"
using namespace std;
#define all(x) x.begin(), x.end()
#define nl '\n'
string guess_sequence(int n) {
vector<char> F {'B', 'X', 'Y'};
string p(n, 'A');
int pf = 0;
int u = press(p);
if(u) {
p = string(n, 'B');
p[0] = 'A';
pf = u;
F.erase(find(all(F), 'B'));
}
for(int i = 0; i < 2; i++) {
auto _p = p;
_p[0] = F[i];
u = press(_p);
if(u) {
p[0] = F[i];
pf = u;
F.erase(find(all(F), F[i]));
break;
}
}
if(!pf) {
p[0] = F[2];
pf = 1;
F.erase(find(all(F), F[2]));
}
pf = press(p);
for(int i = 0; i < n; i++) {
if(i < pf) continue;
for(int j = 0; j < 2; j++) {
p[i] = F[j];
u = press(p);
if(u - pf > 0) {
pf = u;
break;
}
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |