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