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) {
string s, c0, c1, c2;
if (press("AB")) {
if (press("A"))
s = "A", c0 = "B", c1 = "X", c2 = "Y";
else
s = "B", c0 = "A", c1 = "X", c2 = "Y";
} else {
if (press("X"))
s = "X", c0 = "A", c1 = "B", c2 = "Y";
else
s = "Y", c0 = "A", c1 = "B", c2 = "X";
}
for (int i = 1; i + 1 < N; i++) {
int k = press(s + c0 + s + c1 + c0 + s + c1 + c1 + s + c1 + c2) - (int) s.size();
if (k == 0)
s += c2;
else if (k == 1)
s += c0;
else
s += c1;
}
if (N > 1) {
if (press(s + c0) == N)
s += c0;
else if (press(s + c1) == N)
s += c1;
else
s += c2;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |