#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define fios(); ios_base::sync_with_stdio(0);cin.tie(0);
#define file(); freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
int press(string p);
string guess_sequence(int N){
string ans="",s="";
if(press("AB")!=0) {
if(press("A")==1){
ans="A";
s="BXY";
}else{
ans="B";
s="AXY";
}
} else if(press("X")==1) {
ans="X";
s="ABY";
} else {
ans="Y";
s="ABX";
}
for(int i=2;i<=N;i++){
int k=press(ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2]);
if(i==N){
if(press(ans+s[0])==N){
ans+=s[0];
}
else{
ans+=s[1];
}
continue;
}
if(k==ans.size()+1){
ans+=s[0];
}
else if(k==ans.size()+2){
ans+=s[1];
}
else ans+=s[2];
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |