Submission #1064484

#TimeUsernameProblemLanguageResultExecution timeMemory
1064484qlu11708COVID tests (CEOI24_covid)C++14
10 / 100
7054 ms344 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 4; int n; double p; bool students[N]; bool query(int l, int r) { cout << "Q "; for (int i = 1; i <= n; i++) { if (i >= l && i <= r) cout << "1"; else cout << "0"; } cout << "\n"; cout.flush(); char ans; cin >> ans; return ans == 'P'; } void test(int l, int r) { if (query(l, r)) { if (l == r) { students[l] = 1; } else { int m = (l + r) >> 1; test(l, m); test(m + 1, r); } } else { for (int i = l; i <= r; i++) { students[i] = false; } } } void prepare() { for (int i = 0; i <= n; i++) { students[i] = false; } } char solve() { prepare(); test(1, n); cout << "A "; for (int i = 1; i <= n; i++) { cout << (students[i] ? '1' : '0'); } cout << "\n"; cout.flush(); char ans; cin >> ans; return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> n >> p >> t; while (t--) { char verdict = solve(); if (verdict == 'W') { return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...