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 p = ""; std::string S = "";
char f,s,t;
if (press("AB") >= 1){
if (press("A") == 1)
S+='A';
else
S+='B';
}
else
{
if (press("X") == 1)
S+='X';
else
S+='Y';
}
for (int i = 2; i <= N; i++){
p.clear();
if (S[0] == 'A'){
p+=S; p+='B';
p+=S; p+='X'; p+='X';
p+=S; p+='X'; p+='Y';
p+=S; p+='X'; p+='B';
f='B'; s='X'; t='Y';
}
if (S[0] == 'B'){
p+=S; p+='A';
p+=S; p+='X'; p+='X';
p+=S; p+='X'; p+='Y';
p+=S; p+='X'; p+='A';
f='A'; s='X'; t='Y';
}
if (S[0] == 'X'){
p+=S; p+='A';
p+=S; p+='B'; p+='B';
p+=S; p+='B'; p+='Y';
p+=S; p+='B'; p+='A';
f='A'; s='B'; t='Y';
}
if (S[0] == 'Y'){
p+=S; p+='A';
p+=S; p+='B'; p+='B';
p+=S; p+='B'; p+='X';
p+=S; p+='B'; p+='A';
f='A'; s='B'; t='X';
}
if (press(p) == i)
S+=f;
else
if (press(p) == i-1)
S+=t;
else
S+=s;
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |