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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string c[3];
void stp(string s){
int x=0;
string ben[4]={"A", "B", "X", "Y"};
for(int i=0; i<4; i++){
if(ben[i]==s)continue;
c[x]=ben[i];
x++;
}
}
string guess_sequence(int N){
string p="AB";
int x=press(p), lst=1;
if(x==0){
p="X";
if(press(p)==0) p="Y";
}else if(x==1){
p="A";
if(press(p)==0) p="B";
}else p="A";
stp(p);
string S="";
for(int i=2; i<N; i++){
S=p+c[0]+p+c[1]+c[0]+p+c[1]+c[1]+p+c[1]+c[2];
x=press(S);
if(x-lst==0) p=p+c[2];
else if(x-lst==1) p=p+c[0];
else p=p+c[1];
lst++;
}
if(lst==N) return p;
if(press(p+c[0])>lst){
p=p+c[0];
return p;
}
if(press(p+c[1])>lst) p=p+c[1];
else p=p+c[2];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |