답안 #1064484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1064484 2024-08-18T13:14:02 Z qlu11708 COVID tests (CEOI24_covid) C++14
10 / 100
7000 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e3 + 4;
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);
        }
    } else {
        for (int i = l; i <= r; i++) {
            students[i] = false;
        }
    }
}

void prepare() {
    for (int i = 0; i <= n; i++) {
        students[i] = false;
    }
}

char solve() {
    prepare();
    test(1, n);
    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;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 344 KB Output is correct
2 Correct 36 ms 344 KB Output is correct
3 Correct 43 ms 344 KB Output is correct
4 Correct 37 ms 344 KB Output is correct
5 Correct 38 ms 344 KB Output is correct
6 Correct 38 ms 344 KB Output is correct
7 Correct 37 ms 344 KB Output is correct
8 Correct 51 ms 344 KB Output is correct
9 Correct 37 ms 344 KB Output is correct
10 Correct 24 ms 344 KB Output is correct
11 Correct 31 ms 344 KB Output is correct
12 Correct 33 ms 344 KB Output is correct
13 Correct 33 ms 344 KB Output is correct
14 Correct 30 ms 344 KB Output is correct
15 Correct 44 ms 344 KB Output is correct
16 Correct 61 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 159 ms 344 KB Output is correct (P=0.001, F=15.1, Q=17.8) -> 52.47 points
2 Correct 547 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=78.0) -> 28.98 points
3 Correct 1039 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=150.0) -> 27.09 points
4 Correct 2091 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=303.5) -> 26.95 points
5 Correct 2685 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=388.5) -> 27.20 points
6 Correct 3860 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=569.4) -> 27.95 points
7 Correct 5018 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=751.4) -> 28.75 points
8 Correct 6550 ms 340 KB Output is correct (P=0.158765, F=639.1, Q=967.6) -> 29.45 points
9 Execution timed out 7054 ms 344 KB Time limit exceeded (wall clock)
10 Halted 0 ms 0 KB -