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 <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
int press(string);
string guess_sequence(int n) {
string t = "ABXY";
int id = 0;
if (press("XY")) {
id |= 2;
}
if (press("BY")) {
id |= 1;
}
string res = t.substr(id, 1);
t.erase(t.begin() + id);
for (int i = 1; i < n - 1; i++) {
res += t[press(res + t[1] + res + t[2] + t[0] + res + t[2] + t[1] + res + t[2] + t[2]) - i];
}
if (n > 1) {
if (press(res + t[0]) == n) {
res += t[0];
} else if (press(res + t[1]) == n) {
res += t[1];
} else {
res += t[2];
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |