Submission #1036027

# Submission time Handle Problem Language Result Execution time Memory
1036027 2024-07-27T02:23:31 Z sleepntsheep COVID tests (CEOI24_covid) C
10 / 100
3437 ms 344 KB
#include <stdio.h>
#include <string.h>

int n, t;
double p;

char ask(char *q) {
    char result;
    printf("Q %s\n", q);
    fflush(stdout);
    scanf(" %c", &result);
    return result;
}

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

    if (t == 1) {
        char a[1001] = { 0 };
        for (int i = 0; i < n; ++i) {
            char q[1001] = { 0 };
            for (int j = 0; j < n; ++j)
                q[j] = '0' + (j == i);
            a[i] = (ask(q) == 'P') + '0';
        }
        printf("A %s\n", a);
        return 0;
    }

    int x = n / p;

    while (t--) {
        char a[1001] = { 0 };
        for (int i = 0; i < n; ++i)
            a[i] = '0';
        int at = 0;
        while (at < n) {
            char q[1001] = { 0 };
            for (int i = 0; i < n; ++i)
                q[i] = '0';
            for (int i = at; i < at + x && i < n; ++i)
                q[i] = '1';
            if (ask(q) == 'N') {
                at += x;
                continue;
            }

            int lb = at - 1, ub = n;
            while (ub - lb > 1) {
                int md = lb + (ub - lb) / 2;

                for (int i = 0; i < n; ++i)
                    q[i] = '0';
                for (int i = at; i <= md; ++i)
                    q[i] = '1';

                if (ask(q) == '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 'ask':
Main.c:11:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf(" %c", &result);
      |     ^~~~~~~~~~~~~~~~~~~~~
Main.c: In function 'main':
Main.c:16:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d%lf%d", &n, &p, &t);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:69:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |         scanf(" %c", &verdict);
      |         ^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 6 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 6 ms 344 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Correct 7 ms 344 KB Output is correct
15 Correct 6 ms 344 KB Output is correct
16 Correct 5 ms 344 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 344 KB Output is correct (P=0.001, F=15.1, Q=10.7) -> 90.00 points
2 Correct 97 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=52.9) -> 78.89 points
3 Correct 201 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=114.3) -> 49.51 points
4 Correct 560 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=277.8) -> 32.11 points
5 Correct 752 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=389.0) -> 27.13 points
6 Correct 1305 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=664.0) -> 21.16 points
7 Correct 1911 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=1003.2) -> 17.36 points
8 Correct 2893 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=1498.7) -> 14.11 points
9 Execution timed out 3437 ms 344 KB Time limit exceeded (wall clock)
10 Halted 0 ms 0 KB -