#include<bits/stdc++.h>
using namespace std;
int n,t;
double p;
int use=0;
int ask(vector<int>v){
//use++;
cout<<"Q ";
for(auto x:v)cout<<x;
cout<<endl;
//cerr<<"input:"<<endl;
char ans;
cin>>ans;
//cerr<<ans<<endl;
return ans=='P'?1:0;
}
vector<int> fans(int st,int en){
//cerr<<st<<" "<<en<<endl;
if(st>=en)return {};
int m=(st+en)/2;
vector<int>temp(n,0);
for(int i=st;i<=m;i++)temp[i]=1;
vector<int>l,r;
if(ask(temp)){
if(st==m)l={1};
else l=fans(st,m);
}else l=vector<int>(m-st+1,0);
for(int i=st;i<=m;i++)temp[i]=0;
for(int i=m+1;i<=en;i++)temp[i]=1;
if(ask(temp)){
if(m+1==en)r={1};
else r=fans(m+1,en);
}else r=vector<int>(en-m,0);
vector<int>ans;
for(auto x:l)ans.push_back(x);
for(auto x:r)ans.push_back(x);
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n>>p>>t;
while(t--){
//cerr<<"work"<<endl;
use=0;
vector<int>ans=fans(0,n-1);
cout<<"A ";
for(auto x:ans)cout<<x;
cout<<endl;
char res;
cin>>res;
//cerr<<"use:"<<use<<endl;
if(res=='W')break;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
496 KB |
Output is correct |
2 |
Correct |
94 ms |
344 KB |
Output is correct |
3 |
Correct |
69 ms |
344 KB |
Output is correct |
4 |
Correct |
62 ms |
344 KB |
Output is correct |
5 |
Correct |
64 ms |
492 KB |
Output is correct |
6 |
Correct |
65 ms |
344 KB |
Output is correct |
7 |
Correct |
57 ms |
344 KB |
Output is correct |
8 |
Correct |
49 ms |
344 KB |
Output is correct |
9 |
Correct |
56 ms |
344 KB |
Output is correct |
10 |
Correct |
31 ms |
344 KB |
Output is correct |
11 |
Correct |
49 ms |
344 KB |
Output is correct |
12 |
Correct |
49 ms |
344 KB |
Output is correct |
13 |
Correct |
55 ms |
344 KB |
Output is correct |
14 |
Correct |
49 ms |
344 KB |
Output is correct |
15 |
Correct |
69 ms |
492 KB |
Output is correct |
16 |
Correct |
66 ms |
484 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
196 ms |
344 KB |
Output is correct (P=0.001, F=15.1, Q=17.7) -> 53.29 points |
2 |
Correct |
859 ms |
344 KB |
Output is correct (P=0.005256, F=51.1, Q=77.0) -> 29.73 points |
3 |
Correct |
1567 ms |
344 KB |
Output is correct (P=0.011546, F=94.9, Q=149.0) -> 27.44 points |
4 |
Correct |
3177 ms |
344 KB |
Output is correct (P=0.028545, F=191.5, Q=302.5) -> 27.12 points |
5 |
Correct |
3880 ms |
344 KB |
Output is correct (P=0.039856, F=246.3, Q=387.5) -> 27.33 points |
6 |
Correct |
5940 ms |
344 KB |
Output is correct (P=0.068648, F=366.2, Q=568.4) -> 28.05 points |
7 |
Execution timed out |
7034 ms |
504 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |