Submission #1071344

#TimeUsernameProblemLanguageResultExecution timeMemory
1071344jer033COVID tests (CEOI24_covid)C++17
10 / 100
7032 ms344 KiB
#include <bits/stdc++.h> using namespace std; vector<bool> answer(1000, 0); vector<bool> qq(1000, 0); void answer_clear() { answer = vector<bool> (1000, 0); } bool ask_query(vector<bool> a) { cout << "Q "; for (int i=0; i<1000; i++) cout << a[i]; cout << '\n'; cout.flush(); char x; cin >> x; if (x=='P') return 1; return 0; } bool report(vector<bool> a) { cout << "A "; for (int i=0; i<1000; i++) cout << a[i]; cout << '\n'; cout.flush(); char x; cin >> x; if (x=='C') return 1; return 0; } bool range_query(int x, int y) { for (int i=x; i<=y; i++) qq[i] = 1; bool response = ask_query(qq); for (int i=x; i<=y; i++) qq[i] = 0; if (response==1) { if (x==y) answer[x] = 1; else { int z = (x+y)/2; range_query(x, z); range_query(z+1, y); } return 1; } return 0; } int main() { int N, T; long double P; cin >> N >> P >> T; if (T==1) { while (T--) { vector<bool> query(N, 0); vector<bool> ans(N, 0); for (int i=0; i<N; i++) { query[i] = 1; ans[i] = ask_query(query); query[i] = 0; } bool L = report(ans); if (L==0) T = 0; } } else { while (T--) { answer_clear(); range_query(0, 999); bool L = report(answer); if (L==0) T = 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...