結果

問題 No.2095 High Rise
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-10-07 22:47:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 87,104 KB
最終ジャッジ日時 2023-09-03 14:24:46
合計ジャッジ時間 5,000 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,340 KB
testcase_01 AC 75 ms
71,452 KB
testcase_02 AC 73 ms
71,296 KB
testcase_03 AC 74 ms
71,368 KB
testcase_04 AC 73 ms
71,480 KB
testcase_05 AC 73 ms
71,344 KB
testcase_06 AC 73 ms
71,552 KB
testcase_07 AC 74 ms
71,228 KB
testcase_08 AC 75 ms
71,212 KB
testcase_09 AC 74 ms
71,136 KB
testcase_10 AC 76 ms
71,244 KB
testcase_11 AC 73 ms
71,296 KB
testcase_12 AC 103 ms
76,828 KB
testcase_13 AC 82 ms
76,308 KB
testcase_14 AC 83 ms
76,608 KB
testcase_15 AC 84 ms
76,540 KB
testcase_16 AC 82 ms
76,476 KB
testcase_17 AC 104 ms
77,696 KB
testcase_18 AC 102 ms
77,736 KB
testcase_19 AC 86 ms
76,496 KB
testcase_20 AC 101 ms
77,556 KB
testcase_21 AC 122 ms
79,372 KB
testcase_22 AC 230 ms
86,800 KB
testcase_23 AC 231 ms
86,800 KB
testcase_24 AC 235 ms
86,948 KB
testcase_25 AC 235 ms
87,104 KB
testcase_26 AC 233 ms
87,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = [list(map(int,input().split())) for i in range(n)]

if n == 1:
    print(0)
    exit()
dp = A[0]

for i in range(1,n):
    ndp = [0]*m
    mi = min(dp)
    for j in range(m):
        ndp[j] = dp[j]+A[i][j]
        ndp[j] = min(ndp[j],mi+A[i][j]+A[i-1][j])
    dp = ndp
print(min(dp))
0