//#include"combo.h"
#include<bits/stdc++.h>
using namespace std;
#define foru(i,a,b) for(int i=(a); i<=(b); ++i)
#define ford(i,a,b) for(int i=(a); i>=(b); --i)
#define rep(i,a) for(int i=0; i<(a); ++i)
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define bit(s,i) (((s)>>(i))&1)
#define ii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ll long long
#define _ << " " <<
template <class X, class Y> bool maxi(X &x, Y y){return x<y?x=y,true:false;}
template <class X, class Y> bool mini(X &x, Y y){return x>y?x=y,true:false;}
//int press(string p){
// cout<<"? "<<p<<endl;
// int x; cin>>x;
// return x;
//}
int press(string p);
string guess_sequence(int n){
string res;
string t;
if(press("AB")) t="AB";
else t="XY";
char c;
if(press(t.substr(0,1))) c=t[0];
else c=t[1];
string h;
for(char ch:"ABXY") if(ch!=c) h=h+ch;
res=res+c;
foru(i,2,n-1){
int tmp=press(res+h[0]+h[0]+res+h[0]+h[1]+res+h[0]+h[2]+res+h[1]);
if(tmp==i-1) res=res+h[2];
else if(tmp==i) res=res+h[1];
else if(tmp==i+1) res=res+h[0];
else assert(0);
}
c=h[0];
if(press(res+h[1])==n)c=h[1];
if(press(res+h[2])==n)c=h[2];
res=res+c;
return res;
}
//int32_t main(){
//// #define task "test"
//// if(fopen(task".inp","r")){
//// freopen(task".inp","r",stdin);
//// freopen(task".out","w",stdout);
//// }
// cin.tie(0)->sync_with_stdio(0);
//
//// int tc=1; //cin>>tc;
//// rep(i,tc){
//// solve();
//// }
//
// guess_sequence(4);
//
//}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |