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 <vector>
using namespace std;
string guess_sequence(int N) {
string S;
vector<char> possible;
if (press("AB") != 0) {
if (press("A") != 0) {
S = "A";
possible = {'B', 'X', 'Y'};
} else {
S = "B";
possible = {'A', 'X', 'Y'};
}
} else {
if (press("X") != 0) {
S = "X";
possible = {'A', 'B', 'Y'};
} else {
S = "Y";
possible = {'A', 'B', 'X'};
}
}
for (int i = 2; i < N; i++) {
int k =
press(S + possible[0] + S + possible[1] + possible[0] + S +
possible[1] + possible[1] + S + possible[1] + possible[2]);
if (k == i) {
S += possible[0];
} else if (k == i + 1) {
S += possible[1];
} else {
S += possible[2];
}
}
if (N > 1) {
if (press(S + possible[0]) == N)
S += possible[0];
else if (press(S + possible[1]) == N)
S += possible[1];
else
S += possible[2];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |