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