Submission #1084644

#TimeUsernameProblemLanguageResultExecution timeMemory
1084644SulACOVID tests (CEOI24_covid)C++17
10 / 100
8 ms600 KiB
#include <bits/stdc++.h> using namespace std; double power(double base, int pow) { return pow == 0 ? 1 : power(base, pow - 1) * base; } void subtask_1(int n, int k) { string covid(n, '0'); for (int i = 0; i < k; i++) { cout << "Q " << string(i, '0') << '1' << string(n-i-1, '0') << endl; cin >> covid[i]; covid[i] = covid[i] == 'P' ? '1' : '0'; } cout << "A " << covid << endl; } void interact(int n, double p) { // probability of k people being all negative : (1 - p) ^ k // find the largest k such that (1 - p)^k is large enough const double threshold = 0.80; for (int k = n; k >= 0; k--) { if (power(1 - p, k) >= threshold) { return subtask_1(n, n-k); } } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n,t; double p; cin >> n >> p >> t; while (t--) { interact(n, p); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...