結果

問題 No.1199 お菓子配り-2
ユーザー lloyzlloyz
提出日時 2022-03-14 21:26:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 253 ms / 1,000 ms
コード長 366 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 11,804 KB
実行使用メモリ 10,532 KB
最終ジャッジ日時 2023-10-21 08:36:03
合計ジャッジ時間 12,055 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,072 KB
testcase_01 AC 25 ms
10,072 KB
testcase_02 AC 25 ms
10,072 KB
testcase_03 AC 82 ms
10,304 KB
testcase_04 AC 163 ms
10,420 KB
testcase_05 AC 29 ms
10,260 KB
testcase_06 AC 34 ms
10,240 KB
testcase_07 AC 92 ms
10,332 KB
testcase_08 AC 117 ms
10,408 KB
testcase_09 AC 80 ms
10,316 KB
testcase_10 AC 39 ms
10,212 KB
testcase_11 AC 71 ms
10,300 KB
testcase_12 AC 72 ms
10,352 KB
testcase_13 AC 38 ms
10,288 KB
testcase_14 AC 36 ms
10,200 KB
testcase_15 AC 34 ms
10,196 KB
testcase_16 AC 112 ms
10,400 KB
testcase_17 AC 69 ms
10,284 KB
testcase_18 AC 119 ms
10,388 KB
testcase_19 AC 50 ms
10,228 KB
testcase_20 AC 186 ms
10,476 KB
testcase_21 AC 131 ms
10,404 KB
testcase_22 AC 82 ms
10,328 KB
testcase_23 AC 108 ms
10,380 KB
testcase_24 AC 136 ms
10,388 KB
testcase_25 AC 41 ms
10,252 KB
testcase_26 AC 139 ms
10,408 KB
testcase_27 AC 120 ms
10,412 KB
testcase_28 AC 244 ms
10,504 KB
testcase_29 AC 242 ms
10,532 KB
testcase_30 AC 237 ms
10,512 KB
testcase_31 AC 237 ms
10,496 KB
testcase_32 AC 240 ms
10,512 KB
testcase_33 AC 246 ms
10,512 KB
testcase_34 AC 243 ms
10,512 KB
testcase_35 AC 238 ms
10,496 KB
testcase_36 AC 242 ms
10,496 KB
testcase_37 AC 237 ms
10,496 KB
testcase_38 AC 245 ms
10,512 KB
testcase_39 AC 243 ms
10,504 KB
testcase_40 AC 253 ms
10,504 KB
testcase_41 AC 244 ms
10,504 KB
testcase_42 AC 240 ms
10,496 KB
testcase_43 AC 238 ms
10,496 KB
testcase_44 AC 249 ms
10,512 KB
testcase_45 AC 238 ms
10,520 KB
testcase_46 AC 244 ms
10,512 KB
testcase_47 AC 238 ms
10,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
A = []
for _ in range(n):
    B = list(map(int, input().split()))
    A.append(sum(B))

INF = 10**18
DP = [[-INF for _ in range(2)] for _ in range(n + 1)]
DP[0][0] = 0
for i in range(n):
    DP[i + 1][1] = max(DP[i + 1][1], DP[i][1], DP[i][0] + A[i])
    DP[i + 1][0] = max(DP[i + 1][0], DP[i][0], DP[i][1] - A[i])
print(max(DP[n]))
0