Submission #11359420


Source Code Expand

Copy
h,w = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(h)]

dp = [[0]*w for _ in range(h)]
dp[h-1][w-1] = 1
for i in range(h)[::-1]:
    for j in range(w)[::-1]:
        if A[i-1][j] < A[i][j]:
            dp[i-1][j] += dp[i][j] + 1
        if A[i][j-1] < A[i][j]:
            dp[i][j-1] += dp[i][j] + 1

res = 0
for d in dp:
    res += sum(d)
print(res - 1)

Submission Info

Submission Time
Task D - 経路
User ohnuma
Language PyPy3 (2.4.0)
Score 0
Code Size 400 Byte
Status
Exec Time 1058 ms
Memory 224772 KB

Judge Result

Set Name Score / Max Score Test Cases
sample 0 / 0 sample01.txt, sample02.txt
All 0 / 100 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, sample01.txt, sample02.txt, sample01.txt, sample02.txt
Case Name Status Exec Time Memory
00.txt 1043 ms 224772 KB
01.txt 965 ms 192132 KB
02.txt 402 ms 62300 KB
03.txt 162 ms 38256 KB
04.txt 180 ms 38256 KB
05.txt 173 ms 38256 KB
06.txt 164 ms 38256 KB
07.txt 170 ms 39024 KB
08.txt 166 ms 38256 KB
09.txt 170 ms 38256 KB
10.txt 180 ms 39664 KB
11.txt 623 ms 66652 KB
12.txt 597 ms 66396 KB
13.txt 636 ms 66780 KB
14.txt 614 ms 66780 KB
15.txt 1058 ms 192516 KB
16.txt 625 ms 66652 KB
17.txt 602 ms 66524 KB
18.txt 403 ms 62556 KB
19.txt 384 ms 61020 KB
sample01.txt 161 ms 38256 KB
sample02.txt 169 ms 38256 KB