Submission #1060736

#TimeUsernameProblemLanguageResultExecution timeMemory
1060736Dan4LifeCOVID tests (CEOI24_covid)C++17
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a), end(a) using ll = long long; using vi = vector<int>; using ar2 = array<int,2>; using ar3 = array<int,3>; using ar4 = array<int,4>; const int INF = (int)2e9; const int mxN = (int)1e3+10; int N; double P; bitset<mxN> answer, test; bool test_students() { cout << "Q "; for(int i = 0; i < N; i++) cout << test[i]; cout << endl; char c; cin >> c; return (c=='P'); } /// You should implement: // This function will be called once for each test instance. // It should use test_students to determine which samples are positive. // It must return a vector of Booleans of length N, // where the i-th element is true if and only if the i-th sample is positive. void find_positive() { answer.reset(), test.reset(); int l = 0; while(l<N){ test>>=l; test.set(); test<<=l; if(!test_students()) break; test.reset(); int r = N-1, oldL = l; while(l<r){ int mid = (l+r)/2; test>>=oldL; test&=((1<<(mid-oldL+2))-1); test<<=oldL; if(test_students()) r=mid; else l=mid+1; test.reset(); } answer[l]=1; l++; } } int main() { int T; cin >> N >> P >> T; // You may perform any extra initialization here. for (int i = 0; i < T; i++) { find_positive(); cout << "A "; for(int i = 0; i < N; i++) cout << answer[i]; cout << endl; char verdict; cin >> verdict; if (verdict == 'W') exit(0); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...