結果

問題 No.2095 High Rise
ユーザー Akijin_007Akijin_007
提出日時 2022-10-07 22:41:16
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 86,396 KB
実行使用メモリ 86,856 KB
最終ジャッジ日時 2023-09-03 14:11:07
合計ジャッジ時間 5,182 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,156 KB
testcase_01 AC 74 ms
71,124 KB
testcase_02 AC 72 ms
71,092 KB
testcase_03 AC 70 ms
70,704 KB
testcase_04 AC 73 ms
71,156 KB
testcase_05 AC 72 ms
71,272 KB
testcase_06 AC 72 ms
71,124 KB
testcase_07 AC 72 ms
70,712 KB
testcase_08 AC 72 ms
71,108 KB
testcase_09 AC 71 ms
71,084 KB
testcase_10 AC 72 ms
71,072 KB
testcase_11 AC 71 ms
70,708 KB
testcase_12 AC 86 ms
76,236 KB
testcase_13 AC 83 ms
76,396 KB
testcase_14 AC 83 ms
76,252 KB
testcase_15 AC 80 ms
76,096 KB
testcase_16 AC 78 ms
75,928 KB
testcase_17 AC 104 ms
77,452 KB
testcase_18 AC 101 ms
77,300 KB
testcase_19 AC 87 ms
76,320 KB
testcase_20 AC 102 ms
77,196 KB
testcase_21 AC 119 ms
79,092 KB
testcase_22 AC 227 ms
86,640 KB
testcase_23 AC 225 ms
86,688 KB
testcase_24 AC 227 ms
86,856 KB
testcase_25 AC 226 ms
86,552 KB
testcase_26 AC 226 ms
86,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

N, M = map(int, input().split())
A = [0] * N
for i in range(N):
    A[i] = list(map(int, input().split()))

dp = [0] * M
for i in range(M):
    dp[i] = A[0][i]
# print(dp)

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

    for j in range(M):
        ndp[j] = min(m + A[i][j], dp[j])
    dp = list(ndp)

if N == 1:
    print("0")
else:
    print(min(dp))





0