# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
784087 | 2023-07-15T16:07:31 Z | rainboy | Journey (NOI18_journey) | C | 44 ms | 17580 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 284 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 284 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 44 ms | 17580 KB | Output is correct |
8 | Correct | 42 ms | 10800 KB | Output is correct |
9 | Correct | 12 ms | 1620 KB | Output is correct |
10 | Correct | 41 ms | 2020 KB | Output is correct |