# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
544445 | 2022-04-01T23:41:52 Z | rainboy | Jump (BOI06_jump) | C | 8 ms | 4144 KB |
#include <stdio.h> #define N 100 #define L 100 void add(int *aa, int *bb) { int i; for (i = 0; i < L; i++) aa[i] += bb[i]; for (i = 0; i < L; i++) if (aa[i] >= 10) { if (i + 1 < L) aa[i + 1] += aa[i] / 10; aa[i] %= 10; } } int main() { static int dp[N][N][L]; int n, i, j; scanf("%d", &n); dp[0][0][0] = 1; for (i = 0; i < n; i++) for (j = 0; j < n; j++) { int a; scanf("%d", &a); if (a == 0) continue; if (i + a < n) add(dp[i + a][j], dp[i][j]); if (j + a < n) add(dp[i][j + a], dp[i][j]); } i = L - 1; while (i > 0 && dp[n - 1][n - 1][i] == 0) i--; while (i >= 0) printf("%d", dp[n - 1][n - 1][i--]); printf("\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 292 KB | Output is correct |
4 | Correct | 1 ms | 296 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 724 KB | Output is correct |
9 | Correct | 1 ms | 724 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 724 KB | Output is correct |
12 | Correct | 1 ms | 724 KB | Output is correct |
13 | Correct | 1 ms | 852 KB | Output is correct |
14 | Correct | 2 ms | 852 KB | Output is correct |
15 | Correct | 3 ms | 1828 KB | Output is correct |
16 | Correct | 6 ms | 3028 KB | Output is correct |
17 | Correct | 4 ms | 3028 KB | Output is correct |
18 | Correct | 6 ms | 3768 KB | Output is correct |
19 | Correct | 6 ms | 3768 KB | Output is correct |
20 | Correct | 8 ms | 4144 KB | Output is correct |