Submission #1058476

#TimeUsernameProblemLanguageResultExecution timeMemory
1058476rainboyCOVID tests (CEOI24_covid)C11
56.60 / 100
1223 ms596 KiB
#include <stdio.h> #include <string.h> #define N 1000 int min(int a, int b) { return a < b ? a : b; } int n, m; double p; int query(int l, int r) { static char cc[N + 1], s[2]; memset(cc, '0', n * sizeof *cc), memset(cc + l, '1', (r - l) * sizeof *cc), cc[n] = 0; printf("Q %s\n", cc), fflush(stdout); scanf("%s", s); return s[0] == 'P'; } char cc[N + 1]; int b; int solve(int l, int r, int has) { int m; if (!has && !query(l, r)) { memset(cc + l, '0', (r - l) * sizeof *cc); return 0; } if (r - l > 1) { m = (l + r) / 2; solve(m, r, !solve(l, m, 0)); } return 1; } int main() { int t; scanf("%d%lf%d", &n, &p, &t), m = 1 / p; while (t--) { int l; memset(cc, '1', n * sizeof *cc), cc[n] = 0; for (l = 0; l < n; l += m) solve(l, min(l + m, n), 0); printf("A %s\n", cc), fflush(stdout); scanf("%*s"); } return 0; }

Compilation message (stderr)

Main.c: In function 'query':
Main.c:15:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%s", s);
      |  ^~~~~~~~~~~~~~
Main.c: In function 'main':
Main.c:38:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |  scanf("%d%lf%d", &n, &p, &t), m = 1 / p;
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:46:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |   scanf("%*s");
      |   ^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...