답안 #925952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925952 2024-02-12T11:39:31 Z Karoot Jump (BOI06_jump) PyPy 3
100 / 100
73 ms 24732 KB
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))
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 18208 KB Output is correct
2 Correct 28 ms 18236 KB Output is correct
3 Correct 29 ms 18200 KB Output is correct
4 Correct 28 ms 18236 KB Output is correct
5 Correct 28 ms 18284 KB Output is correct
6 Correct 28 ms 18236 KB Output is correct
7 Correct 29 ms 18196 KB Output is correct
8 Correct 33 ms 18204 KB Output is correct
9 Correct 38 ms 19760 KB Output is correct
10 Correct 29 ms 18204 KB Output is correct
11 Correct 30 ms 18228 KB Output is correct
12 Correct 30 ms 18276 KB Output is correct
13 Correct 34 ms 19248 KB Output is correct
14 Correct 43 ms 20784 KB Output is correct
15 Correct 55 ms 22832 KB Output is correct
16 Correct 59 ms 24088 KB Output is correct
17 Correct 73 ms 23456 KB Output is correct
18 Correct 51 ms 22832 KB Output is correct
19 Correct 72 ms 24732 KB Output is correct
20 Correct 60 ms 23352 KB Output is correct