#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,t,k;
double p;
string ans;
int ask(int l,int r){
if(l>r)return false;
string s(n,'0');
for(int i=l;i<=r;i++)s[i]='1';
cout << "Q " << s << endl;
char res;
cin >> res;
return res=='P';
}
int solve(int l,int r){
while(l<r){
int m=(l+r)/2;
if(ask(l,m))r=m;
else l=m+1;
}
ans[l]='1';
return l;
}
void runcase(){
ans=string(n,'0');
for(int l=0;l<n;l+=k){
int r=min(l+k-1,n-1);
if(ask(l,r)){
l=solve(l,r)+1;
}else{
l+=k;
}
}
cout << "A " << ans << endl;
string s;
cin >> s;
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> p >> t;
double q=1-p,r=q;
k=1;
while(r>0.5&&k<n){
r*=q;
k++;
}
while(t--)runcase();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
344 KB |
translate:wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |