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 guess_sequence(int n) {
string s;
if (press("AB")) {
if (press("A")) {
s = "A";
} else {
s = "B";
}
} else {
if (press("X")) {
s = "X";
} else {
s = "Y";
}
}
if (n == 1) {
return s;
}
string L;
if (s == "A") {
L = "BXY";
} else if (s == "B") {
L = "AXY";
} else if (s == "X") {
L = "ABY";
} else {
L = "ABX";
}
for (int i = 1; i < n - 1; ++i) {
string str[3] = {s + L[0], s + L[1], s + L[2]};
int val = press(str[0] + L[0] + str[0] + L[1] + str[0] + L[2] + str[1]);
if (val == i + 2) {
s += L[0];
} else if (val == i + 1) {
s += L[1];
} else {
s += L[2];
}
}
if (press(s + L[0]) == n) {
return s + L[0];
} else if (press(s + L[1]) == n) {
return s + L[1];
} else {
return s + L[2];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |