#include <bits/stdc++.h>
using namespace std;
bool ans[1000];
string question;
int N;
bool ask(int inf, int sup, bool preg){
cin.tie(nullptr);
ios::sync_with_stdio(0);
char c='P';
if(preg){
cout<<"Q ";
for(int i=inf; i<=sup; i++){
question[i]='1';
}
cout<<question<<endl;
for(int i=inf; i<=sup; i++){
question[i]='0';
}
cout.flush();
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;
ask(m+1, sup, ask(inf, m, true));
return true;
}
}
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(0);
int T;
double P;
cin>>N>>P>>T;
double jaskier=0.8;
for(int i=0; i<1000; i++) question.push_back('0');
for(int dalekofrivia=0; dalekofrivia<T; dalekofrivia++){
if(P<0.001) P=0.001;
int u=0.5+log(jaskier/P)/log(2);
int lambda=1;
for(int i=0; i<u; i++) lambda*=2;
for(int i=0; i<N; i++) question[i]='0';
for(int i=0; i<N; i=i+lambda) ask(i, min(i+lambda, N)-1, true);
cout<<"A ";
for(int i=0; i<N; i++) cout<<ans[i];
cout<<endl;
cout.flush();
char C;
cin>>C;
if(C!='C') break;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
344 KB |
Output is correct |
5 |
Correct |
4 ms |
344 KB |
Output is correct |
6 |
Correct |
4 ms |
344 KB |
Output is correct |
7 |
Correct |
6 ms |
344 KB |
Output is correct |
8 |
Correct |
5 ms |
344 KB |
Output is correct |
9 |
Correct |
5 ms |
344 KB |
Output is correct |
10 |
Correct |
3 ms |
344 KB |
Output is correct |
11 |
Correct |
5 ms |
416 KB |
Output is correct |
12 |
Correct |
4 ms |
344 KB |
Output is correct |
13 |
Correct |
7 ms |
344 KB |
Output is correct |
14 |
Correct |
4 ms |
344 KB |
Output is correct |
15 |
Correct |
5 ms |
344 KB |
Output is correct |
16 |
Correct |
4 ms |
596 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
37 ms |
344 KB |
Output is correct (P=0.001, F=15.1, Q=13.9) -> 90.00 points |
2 |
Correct |
116 ms |
344 KB |
Output is correct (P=0.005256, F=51.1, Q=57.7) -> 59.34 points |
3 |
Correct |
201 ms |
344 KB |
Output is correct (P=0.011546, F=94.9, Q=109.8) -> 55.28 points |
4 |
Correct |
403 ms |
344 KB |
Output is correct (P=0.028545, F=191.5, Q=221.2) -> 55.54 points |
5 |
Correct |
499 ms |
344 KB |
Output is correct (P=0.039856, F=246.3, Q=280.4) -> 57.92 points |
6 |
Correct |
770 ms |
344 KB |
Output is correct (P=0.068648, F=366.2, Q=414.4) -> 58.96 points |
7 |
Correct |
922 ms |
344 KB |
Output is correct (P=0.104571, F=490.3, Q=534.1) -> 66.31 points |
8 |
Correct |
1148 ms |
344 KB |
Output is correct (P=0.158765, F=639.1, Q=671.0) -> 75.02 points |
9 |
Correct |
1390 ms |
344 KB |
Output is correct (P=0.2, F=731.4, Q=769.9) -> 74.35 points |