답안 #1084643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084643 2024-09-06T15:37:01 Z SulA COVID tests (CEOI24_covid) C++17
10 / 100
9 ms 1112 KB
#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 << "\n";
}

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);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB translate:wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 7 ms 484 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 6 ms 600 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 6 ms 476 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 6 ms 600 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 7 ms 1112 KB Output is correct
15 Correct 5 ms 344 KB Output is correct
16 Correct 6 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 592 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -