Submission #784087

#TimeUsernameProblemLanguageResultExecution timeMemory
784087rainboyJourney (NOI18_journey)C11
100 / 100
44 ms17580 KiB
#include <stdio.h> #define N 10000 #define M 400 #define INF 500000001 int min(int a, int b) { return a < b ? a : b; } int main() { static int dp[N][M]; int n, m, k, h, i, j, s, t; scanf("%d%d%d", &n, &m, &k); for (i = 0; i < n; i++) { if (i == 0) dp[i][0] = 1; else for (s = 1; s < m; s++) dp[i][s] = min(dp[i][s] + dp[i][s - 1], INF); if (i + 1 < n) { for (h = 0; h < k; h++) { scanf("%d%d", &j, &t); for (s = 0; s + t < m; s++) if (i < j) dp[j][s + t] = min(dp[j][s + t] + dp[i][s], INF); } } else { for (s = 0; s < m; s++) printf("%d ", dp[i][s]); printf("\n"); } } return 0; }

Compilation message (stderr)

journey.c: In function 'main':
journey.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d%d%d", &n, &m, &k);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
journey.c:22:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d%d", &j, &t);
      |     ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...