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 guess_sequence(int n) {
string s, t;
char mander[4]={'A', 'B', 'X', 'Y'};
int x, y;
s+=mander[0];
s+=mander[1];
x=press(s);
s.clear();
if(x>0){
s+=mander[0];
x=press(s);
s.clear();
if(x>0){
s+=mander[0];
swap(mander[0], mander[3]);
}
else{
s+=mander[1];
swap(mander[1], mander[3]);
}
}
else{
s+=mander[2];
x=press(s);
s.clear();
if(x>0){
s+=mander[2];
swap(mander[2], mander[3]);
}
else{
s+=mander[3];
}
}
x=1;
if(n==1){
return s;
}
for(int i=2; i<n; i++){
t+=s;
t+=mander[0];
t+=mander[0];
t+=s;
t+=mander[0];
t+=mander[1];
t+=s;
t+=mander[0];
t+=mander[2];
t+=s;
t+=mander[1];
y=press(t);
if(y==i+1){
s+=mander[0];
}
else if(y==i){
s+=mander[1];
}
else{
s+=mander[2];
}
t.clear();
}
t=s;
t+=mander[0];
x=press(t);
if(x==n){
s+=mander[0];
}
else{
t=s;
t+=mander[1];
x=press(t);
if(x==n){
s+=mander[1];
}
else s+=mander[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |