# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328843 | xiaowuc1 | Jump (BOI06_jump) | Cpython 3 | 35 ms | 3436 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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 < n-1 and i + g[i][j] < n:
dp[i+g[i][j]][j] += dp[i][j]
if j < n-1 and j + g[i][j] < n:
dp[i][j+g[i][j]] += dp[i][j]
print(dp[n-1][n-1])
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |