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"
char guess_first_letter() {
int x = press("AB");
if (x == 1) {
int y = press("A");
if (y == 1) {
return 'A';
} else {
return 'B';
}
} else {
int y = press("X");
if (y == 1) {
return 'X';
} else {
return 'Y';
}
}
}
std::string guess_sequence(int N) {
std::string s;
s += guess_first_letter();
std::string chars;
for (char c : "ABXY") {
if (c != s[0]) chars += c;
}
for (int i = 0; i < N - 2; i++) {
int x = press(
s + chars[0] + chars[0] +
s + chars[0] + chars[1] +
s + chars[0] + chars[2] +
s + chars[1]);
if (x == 0) {
s += chars[2];
} else if (x == 1) {
s += chars[1];
} else {
s += chars[0];
}
}
int x = press(s + chars[0] + s + chars[1]);
if (x == N) {
x = press(s + chars[0]);
if (x == N) {
return s + chars[0];
} else {
return s + chars[1];
}
} else {
return s + chars[2];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |