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 guess_sequence(int n) {
char cs[] = "ABXY";
if (press("AB")) {
if (press("A")) swap(cs[3], cs[0]);
else swap(cs[3], cs[1]);
}
else if (press("X")) swap(cs[3], cs[2]);
string ret = ""; ret += cs[3];
if (n == 1) return ret;
for (int i = 1; i < n - 1; ++i) {
string Q = "";
Q += ret; Q += cs[1];
Q += ret; Q += cs[2]; Q += cs[0];
Q += ret; Q += cs[2]; Q += cs[1];
Q += ret; Q += cs[2]; Q += cs[2];
int R = press(Q);
ret += cs[R - i];
}
if (press(ret + cs[0]) == n) return ret + cs[0];
if (press(ret + cs[1]) == n) return ret + cs[1];
return ret + cs[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |