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 p = "";
string lef = "";
int a = press("AB");
if(a >= 1) {
a = press("A");
p = (a == 1 ? "A" : "B");
lef = (a == 1 ? "BXY" : "AXY");
}
else {
a = press("X");
p = (a == 1 ? "X" : "Y");
lef = (a == 1 ? "ABY" : "ABX");
}
for(int i = 2; i < n; i++) {
string guess = "";
guess += p;
guess += lef[0];
guess += lef[0];
guess += p;
guess += lef[0];
guess += lef[1];
guess += p;
guess += lef[0];
guess += lef[2];
guess += p;
guess += lef[1];
a = press(guess);
if(a - p.length() == 0) {
p += lef[2];
}
else if(a - p.length() == 1) {
p += lef[1];
}
else p += lef[0];
}
if(n >= 2) {
a = press(p + lef[0] + p + lef[1]);
if(a - p.length() == 0) p += lef[2];
else {
a = press(p + lef[0]);
if(a - p.length() == 0) p += lef[1];
else p += lef[0];
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |