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"
#include <bits/stdc++.h>
using namespace std;
string K;
string a,b,c;
std::string guess_sequence(int N) {
//find first letter
if(press("AB")){
if(press("B")){
K="B";
a="A";
b="X";
c="Y";
}else{
K="A";
a="B";
b="X";
c="Y";
}
}else if(press("X")){
K="X";
a="A";
b="B";
c="Y";
}else{
K="Y";
a="A";
b="B";
c="X";
}
int pos=1;
while(pos<N-1){
int ans1,ans2;
ans1=press(K+a+a+K+b+a+K+a+b)-K.size();
if(ans1==2){
ans2=press(K+a+a)-K.size();
if(ans2==0){
K+=(b+a);
pos+=2;
continue;
}else if(ans2==1){
K+=(a+b);
pos+=2;
continue;
}else{
K+=(a+a);
pos+=2;
continue;
}
}else if(ans1==1){
ans2=press(K+b+b)-K.size();
if(ans2==0){
K+=(a+c);
pos+=2;
continue;
}else if(ans2==1){
K+=(b+c);
pos+=2;
continue;
}else{
K+=(b+b);
pos+=2;
continue;
}
}else{
K+=c;
pos++;
continue;
}
}
if(pos==N-1){
if(press(K+a)-K.size()){
K+=a;
}else if(press(K+b)-K.size()){
K+=b;
}else{
K+=c;
}
}
return K;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |