結果

問題 No.2095 High Rise
ユーザー a aa a
提出日時 2022-10-13 08:34:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,287 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 11,016 KB
実行使用メモリ 102,976 KB
最終ジャッジ日時 2023-09-08 18:51:35
合計ジャッジ時間 9,045 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,864 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 15 ms
7,816 KB
testcase_04 AC 15 ms
7,784 KB
testcase_05 AC 15 ms
7,868 KB
testcase_06 AC 15 ms
7,924 KB
testcase_07 AC 15 ms
7,784 KB
testcase_08 AC 15 ms
7,912 KB
testcase_09 AC 15 ms
7,788 KB
testcase_10 AC 15 ms
7,820 KB
testcase_11 AC 15 ms
7,780 KB
testcase_12 AC 18 ms
8,368 KB
testcase_13 AC 19 ms
8,408 KB
testcase_14 AC 22 ms
8,524 KB
testcase_15 AC 19 ms
8,296 KB
testcase_16 AC 17 ms
8,344 KB
testcase_17 AC 151 ms
18,672 KB
testcase_18 AC 110 ms
15,236 KB
testcase_19 AC 37 ms
9,684 KB
testcase_20 AC 161 ms
19,592 KB
testcase_21 AC 284 ms
30,284 KB
testcase_22 AC 1,268 ms
102,952 KB
testcase_23 AC 1,287 ms
102,908 KB
testcase_24 AC 1,268 ms
102,976 KB
testcase_25 AC 1,225 ms
102,884 KB
testcase_26 AC 1,284 ms
102,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=list(map(int,input().split()))
a=[]
for _ in range(n):
    a.append(list(map(int,input().split())))
dp=[[0]*(m) for _ in range(n)]
mi=[0]*(n)
for i in range(n-1):
    for j in range(m):
        if i==0:
            dp[i+1][j]=a[i+1][j]+a[i][j]
        else:
            dp[i+1][j]=min(mi[i]+a[i+1][j]+a[i][j],dp[i][j]+a[i+1][j])
    mi[i+1]=min(dp[i+1])
print(mi[-1])
0