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<vector>
using namespace std;
string guess_sequence(int n) {
string p = "";
if(press("AB")){
if(press("A")) p+="A";
else p+="B";
}
else{
if(press("X")) p+="X";
else p+="Y";
}
vector<char>d={'A','B','X','Y'};
for(int i=0;i<4;i++){
if(d[i]==p[0]){
d.erase(d.begin()+i);
}
}
for(int i=2;i<n;i++){
string f1=p+d[0]+d[0];
string f2=p+d[0]+d[1];
string f3=p+d[0]+d[2];
string f4=p+d[1];
int x=press(f1+f2+f3+f4);
if(x==i-1){
p+=d[2];
}
else if(x==i){
p+=d[1];
}
else{
p+=d[0];
}
}
for(int i=0;i<2;i++){
string f=p+d[i];
if(press(f)==n){
p+=d[i];
break;
}
if(i==1) p+=d[2];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |