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"
std::string guess_sequence(int N) {
std::string s;
char a, b, c, d;
if (press("AB") > 0) {
c = 'X', d = 'Y';
if (press("A")) {
a = 'A';
b = 'B';
} else {
a = 'B';
b = 'A';
}
} else {
c = 'A', d = 'B';
if (press("X")) {
a = 'X';
b = 'Y';
} else {
a = 'Y';
b = 'X';
}
}
s += a;
if (N == 1) {
return s;
}
for (int i = 1; i < N - 1; i++) {
int k = press(s + b + b + s + b + c + s + b + d + s + c);
if (k == i) {
s += d;
} else if (k == i + 1) {
s += c;
} else if (k == i + 2) {
s += b;
}
}
if (press(s + b) == N) {
s += b;
} else if (press(s + c) == N) {
s += c;
} else {
s += d;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |