Submission #1038111

#TimeUsernameProblemLanguageResultExecution timeMemory
1038111ttamxCOVID tests (CEOI24_covid)C++17
83.26 / 100
1458 ms344 KiB
#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,r=k-1;l<n;l+=k,r+=k){ r=min(r,n-1); int x=l; while(ask(x,r))x=solve(x,r)+1; } 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.45&&k<n){ r*=q; k++; } while(t--)runcase(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...