답안 #1036023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1036023 2024-07-27T02:19:10 Z sleepntsheep COVID tests (CEOI24_covid) C
24.29 / 100
3148 ms 344 KB
#include <stdio.h>
#include <string.h>

int n, t;
double p;

int main() {
    scanf("%d%lf%d", &n, &p, &t);

    if (t == 1) {
        char a[1001] = { 0 };
        for (int i = 0; i < n; ++i)
            a[i] = '0';
        for (int i = 0; i < n; ++i) {
            char q[1001] = { 0 };
            for (int j = 0; j < n; ++j)
                q[j] = '0' + (j == i);

            printf("Q %s\n", q);
            fflush(stdout);
            char result;
            scanf(" %c", &result);
            if (result == 'P') a[i] = '1';
        }
        printf("A %s\n", a);
        fflush(stdout);
        return 0;
    }

    while (t--) {
        char a[1001] = { 0 };
        for (int i = 0; i < n; ++i)
            a[i] = '0';
        int at = 0;
        while (at < n) {
            int lb = at - 1, ub = n;
            while (ub - lb > 1) {
                int md = lb + (ub - lb) / 2;

                char q[1001] = { 0 };
                for (int i = 0; i < n; ++i)
                    q[i] = '0';
                for (int j = at; j <= md; ++j)
                    q[j] = '1';

                printf("Q %s\n", q);
                fflush(stdout);
                char result;
                scanf(" %c", &result);
                if (result == 'P') ub = md;
                else lb = md;
            }

            if (ub < n)
                a[ub] = '1';
            at = ub + 1;
        }

        printf("A %s\n", a);
        fflush(stdout);
        char verdict;
        scanf(" %c", &verdict);
        if ('W' == verdict)
            return 0;
    }
}

Compilation message

Main.c: In function 'main':
Main.c:8:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%lf%d", &n, &p, &t);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:22:13: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |             scanf(" %c", &result);
      |             ^~~~~~~~~~~~~~~~~~~~~
Main.c:49:17: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |                 scanf(" %c", &result);
      |                 ^~~~~~~~~~~~~~~~~~~~~
Main.c:62:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |         scanf(" %c", &verdict);
      |         ^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 7 ms 344 KB Output is correct
12 Correct 8 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 5 ms 344 KB Output is correct
16 Correct 7 ms 344 KB Output is correct
17 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 344 KB Output is correct (P=0.001, F=15.1, Q=18.1) -> 50.15 points
2 Correct 105 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=54.2) -> 72.43 points
3 Correct 201 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=108.0) -> 57.98 points
4 Correct 479 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=253.0) -> 39.39 points
5 Correct 635 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=352.5) -> 33.03 points
6 Correct 1120 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=597.4) -> 25.53 points
7 Correct 1707 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=900.1) -> 20.72 points
8 Correct 2511 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=1342.6) -> 16.66 points
9 Correct 3148 ms 344 KB Output is correct (P=0.2, F=731.4, Q=1700.3) -> 14.29 points