結果

問題 No.1199 お菓子配り-2
ユーザー 👑 tamatotamato
提出日時 2020-08-28 21:30:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 1,000 ms
コード長 502 bytes
コンパイル時間 964 ms
コンパイル使用メモリ 87,344 KB
実行使用メモリ 77,976 KB
最終ジャッジ日時 2023-08-08 22:10:37
合計ジャッジ時間 10,704 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,616 KB
testcase_01 AC 58 ms
71,652 KB
testcase_02 AC 59 ms
71,656 KB
testcase_03 AC 89 ms
76,684 KB
testcase_04 AC 127 ms
77,164 KB
testcase_05 AC 64 ms
76,056 KB
testcase_06 AC 65 ms
75,992 KB
testcase_07 AC 93 ms
76,756 KB
testcase_08 AC 104 ms
76,864 KB
testcase_09 AC 88 ms
76,816 KB
testcase_10 AC 69 ms
76,060 KB
testcase_11 AC 81 ms
76,732 KB
testcase_12 AC 85 ms
76,592 KB
testcase_13 AC 71 ms
76,604 KB
testcase_14 AC 70 ms
76,152 KB
testcase_15 AC 70 ms
76,152 KB
testcase_16 AC 103 ms
76,892 KB
testcase_17 AC 84 ms
76,680 KB
testcase_18 AC 108 ms
76,712 KB
testcase_19 AC 76 ms
76,712 KB
testcase_20 AC 137 ms
77,572 KB
testcase_21 AC 113 ms
76,776 KB
testcase_22 AC 96 ms
76,812 KB
testcase_23 AC 98 ms
76,788 KB
testcase_24 AC 110 ms
76,704 KB
testcase_25 AC 71 ms
76,648 KB
testcase_26 AC 117 ms
76,808 KB
testcase_27 AC 105 ms
76,888 KB
testcase_28 AC 151 ms
77,508 KB
testcase_29 AC 151 ms
77,512 KB
testcase_30 AC 160 ms
77,740 KB
testcase_31 AC 157 ms
77,676 KB
testcase_32 AC 153 ms
77,552 KB
testcase_33 AC 158 ms
77,692 KB
testcase_34 AC 160 ms
77,648 KB
testcase_35 AC 155 ms
77,712 KB
testcase_36 AC 154 ms
77,760 KB
testcase_37 AC 156 ms
77,668 KB
testcase_38 AC 156 ms
77,580 KB
testcase_39 AC 153 ms
77,976 KB
testcase_40 AC 152 ms
77,656 KB
testcase_41 AC 157 ms
77,660 KB
testcase_42 AC 160 ms
77,644 KB
testcase_43 AC 148 ms
77,728 KB
testcase_44 AC 163 ms
77,556 KB
testcase_45 AC 160 ms
77,516 KB
testcase_46 AC 165 ms
77,816 KB
testcase_47 AC 155 ms
77,696 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