Submission #1064490

#TimeUsernameProblemLanguageResultExecution timeMemory
1064490qlu11708COVID tests (CEOI24_covid)C++14
0 / 100
7048 ms344 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 4, BS = 30; 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); } } } void prepare() { for (int i = 0; i <= n; i++) { students[i] = false; } } char solve() { prepare(); for (int i = 1; i <= n; i += BS) { if (query(i, i + BS - 1)) { test(i, i + BS - 1); } } 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...