# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
925952 | Karoot | Jump (BOI06_jump) | Pypy 3 | 73 ms | 24732 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.
import math
n = int(input())
mem = []
arr = []
for i in range(n):
mem.append([])
arr.append([])
li = input().split(" ")
for j in range(n):
mem[i].append(-1)
arr[i].append(int(li[j]))
def dp(x, y):
if x == n-1 and y == n-1:
return 1
if mem[x][y] != -1:
return mem[x][y]
val = arr[x][y]
if val == 0:
mem[x][y] = 0
return 0
ret = 0
if x+val < n:
ret += dp(x+val, y)
if y+val < n:
ret += dp(x, y+val)
mem[x][y] = ret
return ret
print(dp(0, 0))
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |