n = int(input())
g = []
dp = []
for _ in range(n):
g.append([int(x) for x in input().split()])
dp.append([0] * n)
dp[0][0] = 1
for i in range(n):
for j in range(n):
if i + g[i][j] < n:
dp[i+g[i][j]][j] += dp[i][j]
if j + g[i][j] < n:
dp[i][j+g[i][j]] += dp[i][j]
print(dp[n-1][n-1])
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
2796 KB |
Output isn't correct |
2 |
Incorrect |
16 ms |
2944 KB |
Output isn't correct |
3 |
Incorrect |
16 ms |
2796 KB |
Output isn't correct |
4 |
Correct |
16 ms |
2796 KB |
Output is correct |
5 |
Incorrect |
19 ms |
2796 KB |
Output isn't correct |
6 |
Incorrect |
17 ms |
2796 KB |
Output isn't correct |
7 |
Incorrect |
17 ms |
2924 KB |
Output isn't correct |
8 |
Incorrect |
18 ms |
2924 KB |
Output isn't correct |
9 |
Incorrect |
18 ms |
2796 KB |
Output isn't correct |
10 |
Incorrect |
19 ms |
2924 KB |
Output isn't correct |
11 |
Incorrect |
18 ms |
2924 KB |
Output isn't correct |
12 |
Incorrect |
18 ms |
2924 KB |
Output isn't correct |
13 |
Incorrect |
18 ms |
2924 KB |
Output isn't correct |
14 |
Incorrect |
20 ms |
2924 KB |
Output isn't correct |
15 |
Incorrect |
23 ms |
3052 KB |
Output isn't correct |
16 |
Incorrect |
28 ms |
3180 KB |
Output isn't correct |
17 |
Incorrect |
28 ms |
3180 KB |
Output isn't correct |
18 |
Incorrect |
31 ms |
3308 KB |
Output isn't correct |
19 |
Incorrect |
31 ms |
3308 KB |
Output isn't correct |
20 |
Incorrect |
35 ms |
3436 KB |
Output isn't correct |