結果

問題 No.1199 お菓子配り-2
ユーザー roarisroaris
提出日時 2020-08-28 21:24:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 1,000 ms
コード長 322 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 76,888 KB
最終ジャッジ日時 2024-04-26 14:14:06
合計ジャッジ時間 9,358 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
54,992 KB
testcase_01 AC 39 ms
54,400 KB
testcase_02 AC 39 ms
54,028 KB
testcase_03 AC 78 ms
75,880 KB
testcase_04 AC 116 ms
76,060 KB
testcase_05 AC 45 ms
64,464 KB
testcase_06 AC 49 ms
67,716 KB
testcase_07 AC 82 ms
75,696 KB
testcase_08 AC 91 ms
75,676 KB
testcase_09 AC 75 ms
75,772 KB
testcase_10 AC 52 ms
73,332 KB
testcase_11 AC 68 ms
75,644 KB
testcase_12 AC 69 ms
75,640 KB
testcase_13 AC 58 ms
75,772 KB
testcase_14 AC 50 ms
71,896 KB
testcase_15 AC 50 ms
70,976 KB
testcase_16 AC 91 ms
75,756 KB
testcase_17 AC 71 ms
75,592 KB
testcase_18 AC 96 ms
75,564 KB
testcase_19 AC 64 ms
75,756 KB
testcase_20 AC 124 ms
75,888 KB
testcase_21 AC 97 ms
76,020 KB
testcase_22 AC 75 ms
75,752 KB
testcase_23 AC 88 ms
75,368 KB
testcase_24 AC 101 ms
75,616 KB
testcase_25 AC 57 ms
75,912 KB
testcase_26 AC 106 ms
75,664 KB
testcase_27 AC 96 ms
75,868 KB
testcase_28 AC 157 ms
76,764 KB
testcase_29 AC 149 ms
76,740 KB
testcase_30 AC 150 ms
76,252 KB
testcase_31 AC 147 ms
76,260 KB
testcase_32 AC 152 ms
76,332 KB
testcase_33 AC 155 ms
76,272 KB
testcase_34 AC 152 ms
76,260 KB
testcase_35 AC 153 ms
76,396 KB
testcase_36 AC 157 ms
76,888 KB
testcase_37 AC 153 ms
76,252 KB
testcase_38 AC 150 ms
76,312 KB
testcase_39 AC 154 ms
76,580 KB
testcase_40 AC 154 ms
76,468 KB
testcase_41 AC 150 ms
76,340 KB
testcase_42 AC 157 ms
76,512 KB
testcase_43 AC 155 ms
76,416 KB
testcase_44 AC 150 ms
76,620 KB
testcase_45 AC 151 ms
76,732 KB
testcase_46 AC 150 ms
76,480 KB
testcase_47 AC 148 ms
76,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, M = map(int, input().split())
A = [sum(list(map(int, input().split()))) for _ in range(N)]
dp = [[0]*2 for _ in range(N+1)]

for i in range(N):
    dp[i+1][0] = max(dp[i][0], dp[i][1]-A[i])
    dp[i+1][1] = max(dp[i][1], dp[i][0]+A[i])

print(max(dp[N]))
0