結果

問題 No.2095 High Rise
ユーザー kyskys
提出日時 2022-10-07 21:57:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,021 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 91,292 KB
最終ジャッジ日時 2023-09-03 01:44:50
合計ジャッジ時間 7,645 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,388 KB
testcase_01 AC 69 ms
71,488 KB
testcase_02 AC 68 ms
71,640 KB
testcase_03 AC 71 ms
71,372 KB
testcase_04 AC 70 ms
71,368 KB
testcase_05 AC 69 ms
71,512 KB
testcase_06 AC 70 ms
71,368 KB
testcase_07 AC 69 ms
71,548 KB
testcase_08 AC 70 ms
71,392 KB
testcase_09 AC 71 ms
71,408 KB
testcase_10 AC 71 ms
71,388 KB
testcase_11 AC 70 ms
71,672 KB
testcase_12 AC 81 ms
76,300 KB
testcase_13 AC 84 ms
76,300 KB
testcase_14 AC 88 ms
76,332 KB
testcase_15 AC 87 ms
76,560 KB
testcase_16 AC 82 ms
76,568 KB
testcase_17 AC 216 ms
78,204 KB
testcase_18 AC 176 ms
77,804 KB
testcase_19 AC 93 ms
76,556 KB
testcase_20 AC 173 ms
78,352 KB
testcase_21 AC 333 ms
79,436 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from sys import stdin, setrecursionlimit
    # setrecursionlimit(1000000)
    input = stdin.readline
    def iinput(): return int(input())
    def sinput(): return input().rstrip()
    def i0input(): return int(input()) - 1
    def linput(): return list(input().split())
    def liinput(): return list(map(int, input().split()))
    def miinput(): return map(int, input().split())
    def li0input(): return list(map(lambda x: int(x) - 1, input().split()))
    def mi0input(): return map(lambda x: int(x) - 1, input().split())
    INF = 1000000000000000000
    MOD = 1000000007

    N, M = miinput()
    A = []
    for _ in [0] * N:
        A.append(liinput())
    
    if N == 1:
        print(0)
        return
    
    dp = [INF] * N
    dp[0] = 0
    
    for i in range(1, N):
        for j in range(M):
            A[i][j] += A[i-1][j]
            dp[i] = min(dp[i], A[i][j])
            for k in range(i-1):
                dp[i] = min(dp[k+1] + A[i][j] - A[k][j], dp[i])

    print(dp[-1])

main()
0