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 <iostream>
using namespace std;
int press(string p);
string guess_sequence(int N){
string S = "";
if (press("AB")){
if (press("A")) S = "A"; else S = "B";
} else {
if (press("X")) S = "X"; else S = "Y";
}
if (N==1) return S;
char A = 'A', B='B', C = 'X';
if (S=="A") A = 'Y'; else if (S=="B") B='Y'; else if (S=="X") C = 'Y';
int res;
while ((int)S.size() < N-1){
res = press(S+A+S+B+A+S+B+B+S+B+C);
if (res == (int)S.size()){
S+=C;
} else if (res == (int)S.size()+1){
S+=A;
} else {
S+=B;
}
}
if (press(S+A+S+B)==N){
if (press(S+A)==N) S+=A; else S+=B;
} else {
S+=C;
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |