This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
const string BUTTONS = "ABXY";
string tmp[4];
int solve(int l, int r) {
if(l == r) {
return l;
}
int m = (l + r) >> 1;
string combo;
for(int i = l; i <= m; ++i) {
for(char ch : tmp[i]) {
combo.push_back(ch);
}
}
if(press(combo) >= (int)tmp[0].size()) {
return solve(l, m);
}
return solve(m + 1, r);
}
string guess_sequence(int N) {
string res;
for(int i = 1; i <= N; ++i) {
for(int j = 0; j < 4; ++j) {
tmp[j] = res;
tmp[j].push_back(BUTTONS[j]);
}
res.push_back(BUTTONS[solve(0, 3)]);
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |