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;
/*int press(string s){
cout<<s<<endl;
int vl;cin>>vl;
return vl;
}*/
std::string guess_sequence(int N) {
string t="ABXY",S="";
if(press("AB")>0){
if(press("A")==1){
S="A";
}else{
S="B";
}
}else{
if(press("X")==1){
S="X";
}else{
S="Y";
}
}
string nw;
for(auto el:t){
if(el!=S[0])nw+=el;
}
t=nw;
for(int i=1;i<N-1;i++){
string cur;
cur+=S+t[1]+t[0];
cur+=S+t[1]+t[1];
cur+=S+t[1]+t[2];
cur+=S+t[0];
int vl=press(cur);
if(vl==i+2){
S+=t[1];
}else if(vl==i+1){
S+=t[0];
}else{
S+=t[2];
}
}
if(N!=1){
for(int i=0;i<2;i++){
string cur;
cur+=S+t[i];
if(press(cur)==N)return cur;
}
string cur;
cur=S+t[2];
return cur;
}
return S;
}
/*int main(){
cout<<guess_sequence(3)<<endl;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |