結果

問題 No.2095 High Rise
ユーザー titiatitia
提出日時 2022-10-07 22:33:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,230 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 1,350 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 48,628 KB
最終ジャッジ日時 2023-09-03 13:52:52
合計ジャッジ時間 9,539 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 16 ms
8,080 KB
testcase_03 AC 16 ms
7,792 KB
testcase_04 AC 16 ms
7,796 KB
testcase_05 AC 16 ms
7,796 KB
testcase_06 AC 16 ms
7,756 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 AC 16 ms
8,096 KB
testcase_09 AC 16 ms
8,156 KB
testcase_10 AC 16 ms
7,776 KB
testcase_11 AC 16 ms
7,788 KB
testcase_12 AC 19 ms
8,284 KB
testcase_13 AC 19 ms
8,192 KB
testcase_14 AC 24 ms
8,188 KB
testcase_15 AC 19 ms
8,224 KB
testcase_16 AC 19 ms
7,708 KB
testcase_17 AC 147 ms
12,528 KB
testcase_18 AC 102 ms
10,976 KB
testcase_19 AC 37 ms
8,884 KB
testcase_20 AC 154 ms
13,212 KB
testcase_21 AC 287 ms
17,780 KB
testcase_22 AC 1,189 ms
48,628 KB
testcase_23 AC 1,230 ms
48,524 KB
testcase_24 AC 1,214 ms
48,556 KB
testcase_25 AC 1,195 ms
48,432 KB
testcase_26 AC 1,184 ms
48,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

if N==1:
    print(0)
    exit()

DP=[0]*M
for i in range(M):
    DP[i]=A[0][i]

for i in range(1,N):
    MIN=1<<62
    for j in range(M):
        MIN=min(MIN,DP[j]+A[i][j])

    NDP=[0]*M

    for j in range(M):
        NDP[j]=min(DP[j],MIN)+A[i][j]

    DP=NDP

print(min(DP))
0