n = int(input())
dp = [[0] * n for i in range(n)]
dp[0][0] = 1
for i in range(n):
d = list(map(int, input().split()))
for j in range(n):
if(d[j] != 0):
if(d[j] + i < n):
dp[d[j] + i][j] = dp[d[j] + i][j] + dp[i][j]
if(d[j] + j < n):
dp[i][d[j] + j] = dp[i][d[j] + j] + dp[i][j]
print(dp[n - 1][n - 1])
#https://codeforces.com/blog/entry/76307?locale=en
#random OI problem 1.12.2020
#meh
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
42 ms |
20168 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
40 ms |
20168 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
41 ms |
20168 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
41 ms |
20168 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
41 ms |
20168 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
39 ms |
20296 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
41 ms |
20168 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
40 ms |
20168 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
38 ms |
20168 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
40 ms |
20296 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
39 ms |
20168 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
43 ms |
20168 KB |
Execution failed because the return code was nonzero |