답안 #873353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873353 2023-11-14T22:23:28 Z bobbilyking Jump (BOI06_jump) Python 3
100 / 100
19 ms 3420 KB
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])
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 3168 KB Output is correct
2 Correct 11 ms 3012 KB Output is correct
3 Correct 10 ms 2908 KB Output is correct
4 Correct 12 ms 3004 KB Output is correct
5 Correct 12 ms 2908 KB Output is correct
6 Correct 11 ms 2864 KB Output is correct
7 Correct 11 ms 2908 KB Output is correct
8 Correct 12 ms 2908 KB Output is correct
9 Correct 11 ms 2908 KB Output is correct
10 Correct 11 ms 2824 KB Output is correct
11 Correct 11 ms 3028 KB Output is correct
12 Correct 11 ms 3048 KB Output is correct
13 Correct 11 ms 3004 KB Output is correct
14 Correct 11 ms 2908 KB Output is correct
15 Correct 14 ms 3164 KB Output is correct
16 Correct 16 ms 3164 KB Output is correct
17 Correct 18 ms 3164 KB Output is correct
18 Correct 19 ms 3276 KB Output is correct
19 Correct 19 ms 3420 KB Output is correct
20 Correct 19 ms 3420 KB Output is correct