#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair
#define F first
#define all(v) v.begin(),v.end()
#define V vector
#define pb push_back
std::string guess_sequence(int n){
string t;
V<char>vp={'A','B','X','Y'};
char x;
bool f=false;
for(int i=0;i<3;i++){
if(press(t+vp[i])==1){
x=vp[i];
t+=vp[i];
f=true;
break;
}
}
if(!f){
t+=vp[3];
x=vp[3];
}
V<char>vp1;
for(auto u:vp){
if(u!=x) {
vp1.pb(u);
}
}
for(int i=1;i<n-1;i++){
string r="";
for(auto u:vp1){
r+=t;
r+=vp1[0];
r+=u;
}
r+=t;
r+=vp1[1];
int ans=press(r);
if(ans==i+2){
t+=vp1[0];
}
else if(ans==i+1){
t+=vp1[1];
}
else
t+=vp1[2];
}
for(auto u:vp1){
if(press(t+u)==n){
t+=u;
break;
}
}
return t;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |