結果

問題 No.1199 お菓子配り-2
ユーザー rlangevinrlangevin
提出日時 2023-01-15 12:16:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 1,000 ms
コード長 363 bytes
コンパイル時間 1,463 ms
コンパイル使用メモリ 86,136 KB
実行使用メモリ 77,740 KB
最終ジャッジ日時 2023-08-27 19:57:58
合計ジャッジ時間 19,188 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,276 KB
testcase_01 AC 82 ms
71,296 KB
testcase_02 AC 83 ms
71,188 KB
testcase_03 AC 127 ms
77,188 KB
testcase_04 AC 169 ms
77,204 KB
testcase_05 AC 87 ms
75,644 KB
testcase_06 AC 91 ms
75,660 KB
testcase_07 AC 121 ms
76,368 KB
testcase_08 AC 135 ms
76,160 KB
testcase_09 AC 116 ms
76,260 KB
testcase_10 AC 92 ms
75,648 KB
testcase_11 AC 109 ms
76,176 KB
testcase_12 AC 107 ms
76,152 KB
testcase_13 AC 89 ms
75,604 KB
testcase_14 AC 92 ms
75,604 KB
testcase_15 AC 89 ms
75,668 KB
testcase_16 AC 135 ms
76,284 KB
testcase_17 AC 112 ms
76,160 KB
testcase_18 AC 149 ms
76,836 KB
testcase_19 AC 104 ms
76,136 KB
testcase_20 AC 181 ms
77,452 KB
testcase_21 AC 151 ms
77,268 KB
testcase_22 AC 127 ms
76,736 KB
testcase_23 AC 137 ms
77,088 KB
testcase_24 AC 148 ms
77,220 KB
testcase_25 AC 90 ms
75,668 KB
testcase_26 AC 153 ms
77,052 KB
testcase_27 AC 137 ms
76,244 KB
testcase_28 AC 205 ms
77,492 KB
testcase_29 AC 204 ms
77,568 KB
testcase_30 AC 207 ms
77,412 KB
testcase_31 AC 212 ms
77,568 KB
testcase_32 AC 206 ms
77,308 KB
testcase_33 AC 206 ms
77,492 KB
testcase_34 AC 210 ms
77,668 KB
testcase_35 AC 205 ms
77,444 KB
testcase_36 AC 207 ms
77,448 KB
testcase_37 AC 206 ms
77,604 KB
testcase_38 AC 206 ms
77,436 KB
testcase_39 AC 209 ms
77,456 KB
testcase_40 AC 209 ms
77,740 KB
testcase_41 AC 209 ms
77,320 KB
testcase_42 AC 208 ms
77,460 KB
testcase_43 AC 206 ms
77,600 KB
testcase_44 AC 208 ms
77,324 KB
testcase_45 AC 209 ms
77,544 KB
testcase_46 AC 206 ms
77,528 KB
testcase_47 AC 205 ms
77,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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