結果

問題 No.2095 High Rise
ユーザー minimumminimum
提出日時 2023-03-31 21:26:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,612 KB
実行使用メモリ 84,896 KB
最終ジャッジ日時 2023-10-24 07:12:25
合計ジャッジ時間 4,959 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,356 KB
testcase_01 AC 36 ms
53,356 KB
testcase_02 AC 39 ms
53,356 KB
testcase_03 AC 36 ms
53,356 KB
testcase_04 AC 37 ms
53,356 KB
testcase_05 AC 36 ms
53,356 KB
testcase_06 AC 37 ms
53,356 KB
testcase_07 AC 36 ms
53,356 KB
testcase_08 AC 36 ms
53,356 KB
testcase_09 AC 36 ms
53,356 KB
testcase_10 AC 37 ms
53,356 KB
testcase_11 AC 37 ms
53,356 KB
testcase_12 AC 65 ms
61,936 KB
testcase_13 AC 48 ms
61,952 KB
testcase_14 AC 47 ms
61,940 KB
testcase_15 AC 45 ms
61,940 KB
testcase_16 AC 44 ms
59,884 KB
testcase_17 AC 71 ms
75,848 KB
testcase_18 AC 68 ms
75,884 KB
testcase_19 AC 51 ms
66,048 KB
testcase_20 AC 71 ms
75,860 KB
testcase_21 AC 85 ms
77,404 KB
testcase_22 AC 182 ms
84,892 KB
testcase_23 AC 184 ms
84,788 KB
testcase_24 AC 189 ms
84,872 KB
testcase_25 AC 184 ms
84,896 KB
testcase_26 AC 186 ms
84,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = float('inf')
N, M = map(int, input().split())
if N == 1:
    exit(print(0))
A = [list(map(int, input().split())) for _ in range(N)]

dp = [0] * M
for i in range(N):
    ndp = [dp[j] + A[i][j] for j in range(M)]
    m = min(ndp)
    nndp = [min(ndp[j], m + A[i][j]) for j in range(M)]
    dp = nndp

print(min(dp))
0