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"
using namespace std;
string a[] = {"A", "B", "X", "Y"};
std::string guess_sequence(int N) {
int f = 0;
if (press("AB")) {
f = press("B");
} else {
f = press("Y") + 2;
}
string ans = a[f];
if (N == 1) {
return ans;
}
string x = a[f == 0 ? 1 : 0];
string y = a[f <= 1 ? 2 : 1];
string z = a[f == 3 ? 2 : 3];
for (int i = 1; i < N - 1; i++) {
int t = press(ans + x + ans + y + x + ans + y + y + ans + y + z);
if (t == i + 1) {
ans = ans + x;
} else if (t == i + 2) {
ans = ans + y;
} else {
ans = ans + z;
}
}
if (press(ans + x) == N) {
ans = ans + x;
} else if (press(ans + y) == N) {
ans = ans + y;
} else {
ans = ans + z;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |