# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784087 | rainboy | Journey (NOI18_journey) | C11 | 44 ms | 17580 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |