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"
#include <bits/stdc++.h>
using namespace std;
string avail[3];
int val, i;
string guess_sequence(int n) {
string p = "";
if (press("AB") > 0) {
if (press("A") == 1) {
avail[0] = "B";
avail[1] = "X";
avail[2] = "Y";
p = "A";
}
else {
avail[0] = "A";
avail[1] = "X";
avail[2] = "Y";
p = "B";
}
}
else if (press("X") == 1) {
avail[0] = "B";
avail[1] = "A";
avail[2] = "Y";
p = "X";
}
else {
avail[0] = "B";
avail[1] = "X";
avail[2] = "A";
p = "Y";
}
if (n == 1) {
return p;
}
for (i=2; i < n; ++i) {
val = press(p+avail[0]+p+avail[1]+avail[0]+p+avail[1]+avail[1]+p+avail[1]+avail[2]);
if (val == i-1) {
p += avail[2];
}
else if (val == i) {
p += avail[0];
}
else {
p += avail[1];
}
}
if (press(p+avail[0]) == n) return p+avail[0];
else if (press(p+avail[1]) == n) return p+avail[1];
else return p+avail[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |