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 str;
int res;
char a,b,c;
if(press("AB"))
if(press("A"))
str="A",a='B',b='X',c='Y';
else
str="B",a='A',b='X',c='Y';
else
if(press("X"))
str = "X",a='Y',b='A',c='B';
else
str = "Y",a='X',b='A',c='B';
if(N==1) return str;
for(int i = 1; i < N-1; i++) {
res = press(str+a+str+b+a+str+b+b+str+b+c);
if(res==i)
str+=c;
if(res==i+1)
str+=a;
if(res==i+2)
str+=b;
}
if(press(str+a)==N)
str+=a;
else if(press(str+b)==N)
str+=b;
else
str+=c;
return str;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |