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, q, r;
string S;
if (press("AB")){
if (press("A")) S="A", p="B", q="X", r="Y";
else p="A", S="B", q="X", r="Y";
}
else{
if (press("X")) p="A", q="B", S="X", r="Y";
else p="A", q="B", r="X", S="Y";
}
if (N == 1) return S;
for (int i=1; i<N-1; i++){
int ret = press(S+p+p+S+p+q+S+p+r+S+q);
if (ret == i) S += r;
if (ret == i+1) S += q;
if (ret == i+2) S += p;
}
if (press(S+p) == N) return S+p;
if (press(S+q) == N) return S+q;
return S+r;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |