結果

問題 No.1199 お菓子配り-2
ユーザー tamatotamato
提出日時 2020-08-28 21:30:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 1,000 ms
コード長 502 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 77,116 KB
最終ジャッジ日時 2024-04-26 14:18:57
合計ジャッジ時間 9,388 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,992 KB
testcase_01 AC 37 ms
53,664 KB
testcase_02 AC 37 ms
52,664 KB
testcase_03 AC 73 ms
75,428 KB
testcase_04 AC 122 ms
75,956 KB
testcase_05 AC 44 ms
62,928 KB
testcase_06 AC 45 ms
67,504 KB
testcase_07 AC 83 ms
75,484 KB
testcase_08 AC 91 ms
75,824 KB
testcase_09 AC 75 ms
75,960 KB
testcase_10 AC 50 ms
73,724 KB
testcase_11 AC 69 ms
75,644 KB
testcase_12 AC 65 ms
75,428 KB
testcase_13 AC 50 ms
73,160 KB
testcase_14 AC 49 ms
71,112 KB
testcase_15 AC 48 ms
68,464 KB
testcase_16 AC 90 ms
75,932 KB
testcase_17 AC 69 ms
75,672 KB
testcase_18 AC 95 ms
75,776 KB
testcase_19 AC 61 ms
75,488 KB
testcase_20 AC 127 ms
75,748 KB
testcase_21 AC 98 ms
75,492 KB
testcase_22 AC 77 ms
75,644 KB
testcase_23 AC 87 ms
75,364 KB
testcase_24 AC 101 ms
75,492 KB
testcase_25 AC 51 ms
73,684 KB
testcase_26 AC 104 ms
75,672 KB
testcase_27 AC 93 ms
76,076 KB
testcase_28 AC 155 ms
76,504 KB
testcase_29 AC 155 ms
76,812 KB
testcase_30 AC 156 ms
76,332 KB
testcase_31 AC 153 ms
76,392 KB
testcase_32 AC 150 ms
76,344 KB
testcase_33 AC 151 ms
76,500 KB
testcase_34 AC 152 ms
76,252 KB
testcase_35 AC 156 ms
76,424 KB
testcase_36 AC 152 ms
76,988 KB
testcase_37 AC 151 ms
76,172 KB
testcase_38 AC 152 ms
76,500 KB
testcase_39 AC 151 ms
76,264 KB
testcase_40 AC 153 ms
76,796 KB
testcase_41 AC 154 ms
76,324 KB
testcase_42 AC 154 ms
76,632 KB
testcase_43 AC 154 ms
76,432 KB
testcase_44 AC 157 ms
76,324 KB
testcase_45 AC 151 ms
76,252 KB
testcase_46 AC 151 ms
76,452 KB
testcase_47 AC 150 ms
77,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9
inf = 10**20


def main():
    import sys
    input = sys.stdin.readline

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

    dp = [[-inf] * 2 for _ in range(N+1)]
    dp[0][0] = 0
    for i in range(N):
        dp[i+1][1] = max(dp[i][1], dp[i][0] + A[i])
        dp[i+1][0] = max(dp[i][0], dp[i][1] - A[i])
    print(max(dp[-1]))


if __name__ == '__main__':
    main()
0