Submission #1068706

#TimeUsernameProblemLanguageResultExecution timeMemory
1068706AlebnCOVID tests (CEOI24_covid)C++14
0 / 100
3975 ms344 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int n, t, mid; double p; string res, ask; char temp; bool ok; void bs(int l, int r) { if(l == r) res[l] = '1'; else { mid = (l + r) / 2; for(int i = 0; i < n; i++) { if(l <= i && i <= mid) ask[i] = '1'; else ask[i] = '0'; } cout << "Q " << ask << endl; cin >> temp; if(temp == 'P') bs(l, mid); // for(int i = 0; i < n; i++) { if(mid + 1 <= i && i <= r) ask[i] = '1'; else ask[i] = '0'; } cout << "Q " << ask << endl; cin >> temp; if(temp == 'P') bs(mid + 1, r); } } void solve() { res = string(n, '0'); ask = string(n, '1'); cout << "Q " << ask << endl; cin >> temp; if(temp == 'P') bs(0, n - 1); cout << "A " << res << endl; cin >> temp; if(temp == 'W') ok = false; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> p >> t; ok = true; while(t-- && ok) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...