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>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
int r, i;
string c, s;
if (press("AB")) {
if (press("A")) c = "ABXY";
else c = "BXYA";
} else {
if (press("X")) c = "XYAB";
else c = "YABX";
}
s = c[0];
if (N == 1) return s;
for (i = 1; i < N - 1; ++i) {
r = press(s + c[1] + c[1] + s + c[1] + c[2] + s + c[1] + c[3] + s + c[2]) - i;
if (r == 2) s += c[1];
else if (r == 1) s += c[2];
else s += c[3];
}
if (press(s + "A" + s + "B") == N) {
if (press(s + "A") == N) s += "A";
else s += "B";
} else {
if (press(s + "X") == N) s += "X";
else s += "Y";
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |