#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define inf (int)5e18
#define nl endl
int n, x;
int qry(int l, int r){
cout<<"Q "<<string(l, '0') + string(r-l+1, '1') + string(n-1-r, '0')<<nl;
char c;
cin>>c;
return c == 'P';
}
void solve(){
string ans(n, '0');
for(int i = 0; i < n;){
int l = i, r = min(i+x-1, n-1);
if(!qry(l, r)){
i += x;
continue;
}
while(l < r){
int m = (l+r)/2;
if(qry(l, m)) r = m;
else l = m+1;
}
ans[l] = '1';
i = l+1;
}
cout<<"A "<<ans<<nl;
char c;
cin>>c;
if(c == 'W') exit(0);
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);cout.tie(NULL);
int t = 1;
ld p;
cin>>n>>p>>t;
if(p < 0.002) x = 1000;
else if(p < 0.006) x = 126;
else if(p < 0.02) x = 64;
else if(p < 0.029) x = 24;
else if(p < 0.04) x = 16;
else if(p < 0.07) x = 8;
else if(p < 0.11) x = 7;
else if(p < 0.16) x = 4;
else x = 3;
if(t == 1) x = 1;
while(t--) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |