#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define pb push_back
#define ll long long
const int off=1<<19;
const int inf=1e9+4;
const int mxsz=2e5+4;
string guess_sequence(int n) {
string p = "XY";
int x;
//cout<<p<<endl;
x=press(p);
if (x>0){
p="X";
x=press(p);
if (x==0){
p="Y";
}
}else{
p="A";
x=press(p);
//cout<<x<<endl;
if (x==0){
p="B";
}
}
if (n==1)return p;
string chs="ABXY";
for (int i=0;i<4;i++){
if (chs[i]==p[0])chs[i]='#';
}
string k;
for (auto x:chs){
if (x!='#')k.pb(x);
}
//cout<<p<<endl;
//cout<<k<<endl;
int cnt=1;
int tmp=n-2;
int j=0;
while (tmp--){
string s=p+k[j]
+p+k[j+1]+k[j]
+p+k[j+1]+k[j+1]
+p+k[j+1]+k[j+2];
//cout<<"DSfj";
x=press(s);
//cout<<"DSfj";
if (x==p.size()+0){
p+=k[j+2];
}else if (x==p.size()+1){
p+=k[j];
}else{
p+=k[j+1];
}
cnt++;
}
string s=p+k[j]
+p+k[j+1];
x=press(s);
if (x==p.size()+1){
s=p+k[j];
x=press(s);
if (x==cnt){
s=p+k[j+1];
}
}else{
s=p+k[j+2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |