Submission #332082

# Submission time Handle Problem Language Result Execution time Memory
332082 2020-12-01T11:46:01 Z Valera_Grinenko Jump (BOI06_jump) Python 3
100 / 100
37 ms 3436 KB
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
# Verdict Execution time Memory Grader output
1 Correct 17 ms 3052 KB Output is correct
2 Correct 17 ms 2796 KB Output is correct
3 Correct 16 ms 2796 KB Output is correct
4 Correct 16 ms 2796 KB Output is correct
5 Correct 16 ms 2796 KB Output is correct
6 Correct 17 ms 2796 KB Output is correct
7 Correct 17 ms 2796 KB Output is correct
8 Correct 18 ms 2924 KB Output is correct
9 Correct 18 ms 2924 KB Output is correct
10 Correct 18 ms 2924 KB Output is correct
11 Correct 18 ms 2924 KB Output is correct
12 Correct 19 ms 2924 KB Output is correct
13 Correct 19 ms 2924 KB Output is correct
14 Correct 19 ms 2924 KB Output is correct
15 Correct 23 ms 3052 KB Output is correct
16 Correct 31 ms 3308 KB Output is correct
17 Correct 29 ms 3180 KB Output is correct
18 Correct 34 ms 3308 KB Output is correct
19 Correct 32 ms 3180 KB Output is correct
20 Correct 37 ms 3436 KB Output is correct