# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
873353 | bobbilyking | Jump (BOI06_jump) | Cpython 3 | 19 ms | 3420 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())
arr = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(n)] for _ in range(n)]
dp[0][0]=1
arr[n-1][n-1] = 2
# print("\n".join(' '.join(str(x) for x in v) for v in arr))
for i in range(n):
for j in range(n):
if i + arr[i][j] < n:
dp[i+arr[i][j]][j]+=dp[i][j]
if j + arr[i][j] < n:
dp[i][j+arr[i][j]]+=dp[i][j]
# print(' '.join(str(x) for x in dp[i]))
print(dp[n-1][n-1])
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |