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"
using namespace std;
string guess_sequence(int N) {
string p = "";
if (press("AB")) {
if (press("A")) {
p="A";
} else {
p="B";
}
} else{
if (press("X")) {
p="X";
} else {
p="Y";
}
}
if (N==1)
return p;
string tmp="ABXY";
string chars="";
for (int i=0; i < 4; i++) {
if (tmp[i]!=p[0]) {
chars+=tmp[i];
}
}
string guess;
for (int i = 1; i < N-1; ++i) {
guess="";
for (int j=0; j < 3; j++) {
guess += p+chars[0]+chars[j];
}
guess += p+chars[1];
int x = press(guess);
if (x == i+2) p+=chars[0];
else if (x == i+1) p+=chars[1];
else p+=chars[2];
}
guess = p+chars[0]+p+chars[1];
if (press(guess)==N) {
if (press(p+chars[0])==N) {
p+=chars[0];
} else {
p+=chars[1];
}
} else {
p+=chars[2];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |