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 guess_sequence(int N){
int a = press("AB");
string fi;
if(a){
if(press("A"))fi = "A";
else fi = "B";
}else{
if(press("X"))fi = "X";
else fi = "Y";
}
set<char> rem;
if(fi[0]!='X')rem.insert('X');
if(fi[0]!='A')rem.insert('A');
if(fi[0]!='B')rem.insert('B');
if(fi[0]!='Y')rem.insert('Y');
vector<char> v;
for(auto i:rem)v.push_back(i);
for(int i = 2;i<N;i++){
string qu;
qu+=fi;
qu+=v[0];
qu+=v[0];
qu+=fi;
qu+=v[0];
qu+=v[1];
qu+=fi;
qu+=v[0];
qu+=v[2];
qu+=fi;
qu+=v[1];
int an = press(qu);
if(an==i-1){
fi+=v[2];
}else if(an==i){
fi+=v[1];
}else fi+=v[0];
}
string qu;
qu+=fi;
qu+=v[0];
qu+=fi;
qu+=v[1];
if(press(qu)==N){
string qu2;
qu2+=fi;
qu2+=v[0];
if(press(qu2)==N){
fi+=v[0];
}else fi+=v[1];
}else fi+=v[2];
return fi;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |