Submission #1039303

#TimeUsernameProblemLanguageResultExecution timeMemory
1039303Dalek_of_RiviaCOVID tests (CEOI24_covid)C++17
0 / 100
7064 ms344 KiB
#include <bits/stdc++.h> using namespace std; bool ans[1000]; 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=0; i<N; i++){ if((i<inf)|(i>sup)){ cout<<0; }else{ cout<<1; } } cout<<endl; 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 dalekofrivia=0; dalekofrivia<T; dalekofrivia++){ if(P<0.001) P=0.001; int lambda=(jaskier/P); 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...