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;
string guess_sequence(int n) {
string s;
string a[4] = {"A", "B", "X", "Y"};
int fr = -1;
for (int j = 0; j < 4; j++) {
if (press(a[j]) == 1) {
s += a[j];
fr = j;
}
}
for (int i = 1; i < n; i++) {
int cnt = 0, ind = -1, lst = -1;
for (int j = 0; j < 4; j++) {
if (j != fr && cnt < 2) {
cnt++;
if (cnt == 2) {
lst = j;
}
if (press(s + a[j]) == (i + 1)) {
ind = j;
}
}
}
if (ind != -1) {
s += a[ind];
} else {
for (int j = lst + 1; j < 4; j++) {
if (j != fr) {
s += a[j];
}
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |