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 c0 = "";
vector<string> opts;
if (press("AB")) {
if (press("A")) {
c0 = "A";
opts = {"B", "X", "Y"};
} else{
c0 = "B";
opts = {"A", "X", "Y"};
}
} else {
if (press("X")) {
c0 = "X";
opts = {"A", "B", "Y"};
} else {
c0 = "Y";
opts = {"A", "B", "X"};
}
}
string ans = c0;
string q;
for (int i=1; i<n-1; i++) {
q = ans+opts[0];
for (int j=0; j<3; j++) {
q += ans+opts[1]+opts[j];
}
int l = press(q);
if (l == i) {
ans += opts[2];
} else if (l == i+1) {
ans += opts[0];
} else {
ans += opts[1];
}
}
if (n > 1) {
if (press(ans+opts[0])) {
ans += opts[0];
} else if (press(ans+opts[1])) {
ans += opts[1];
} else {
ans += opts[2];
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |