This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bool ans[1000];
int N;
bool ask(int inf, int sup, bool preg){
char c='P';
if(preg){
cout<<"Q ";
for(int i=0; i<N; i++){
if((i<inf)|(i>sup)){
cout<<0;
}else{
cout<<1;
}
}
cout<<endl;
cin>>c;
}
if(c=='N'){
for(int i=inf; i<=sup; i++) ans[i]=false;
return false;
}else if(inf==sup){
ans[inf]=true;
return true;
}else{
int m = (inf+sup)/2;
bool tau=ask(inf, m, true);
ask(m+1, sup, tau);
return true;
}
}
int main()
{
int T;
double P;
cin>>N>>P>>T;
double jaskier=0.5;
for(int dalekofrivia=0; dalekofrivia<T; dalekofrivia++){
int lambda=jaskier/P;
for(int i=0; i<N; i+=lambda) ask(i, min(i+lambda, N)-1, true);
cout<<"A ";
for(int i=0; i<N; i++) cout<<ans[i];
cout<<endl;
char C;
cin>>C;
if(C!='C') break;
}
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... |