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 = "",S="",c="";
char c1;
int P;
P=press("AB");
if (P){
P=press("A");
if (P) c1='A';
if (!P) c1='B';
}else{
P=press("X");
if (P) c1='X';
if (!P) c1='Y';
}
S.push_back(c1);
if (N==1) return S;
if ('A'!=c1) c.push_back('A');
if ('B'!=c1) c.push_back('B');
if ('X'!=c1) c.push_back('X');
if ('Y'!=c1) c.push_back('Y');
for (int i=2;i<N;i++){
p=S+c[1]+S+c[2]+c[0]+S+c[2]+c[1]+S+c[2]+c[2];
S.push_back(c[press(p)-S.size()]);
}
P=press(S+'A'+S+'B');
if (P==N){
P=press(S+"A");
if (P==N) S.push_back('A');
if (P<N) S.push_back('B');
}else{
P=press(S+"X");
if (P==N) S.push_back('X');
if (P<N) S.push_back('Y');
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |