Submission #544607

#TimeUsernameProblemLanguageResultExecution timeMemory
544607rainboyBrunhilda’s Birthday (BOI13_brunhilda)C11
100 / 100
241 ms80252 KiB
#include <stdio.h> #include <string.h> #define N 10000000 #define INF 0x3f3f3f3f int main() { static int rr[N + 1], dp[N + 1]; int m, q, h, i, j; scanf("%d%d", &m, &q); for (h = 0; h < m; h++) { int p; scanf("%d", &p); for (i = 0; i <= N; i += p) rr[i] = i + p; } memset(dp, 0x3f, (N + 1) * sizeof *dp), dp[0] = 0; for (i = 0, j = 1; i <= N && dp[i] != INF; i++) while (j <= N && j < rr[i]) dp[j++] = dp[i] + 1; while (q--) { int n; scanf("%d", &n); if (dp[n] == INF) printf("oo\n"); else printf("%d\n", dp[n]); } return 0; }

Compilation message (stderr)

brunhilda.c: In function 'main':
brunhilda.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d", &m, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
brunhilda.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &p);
      |   ^~~~~~~~~~~~~~~
brunhilda.c:26:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   scanf("%d", &n);
      |   ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...