結果

問題 No.1199 お菓子配り-2
ユーザー anagohirameanagohirame
提出日時 2020-08-28 21:42:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 195 ms / 1,000 ms
コード長 371 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 77,644 KB
最終ジャッジ日時 2023-08-08 22:25:05
合計ジャッジ時間 11,049 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,372 KB
testcase_01 AC 70 ms
71,128 KB
testcase_02 AC 70 ms
71,292 KB
testcase_03 AC 107 ms
76,344 KB
testcase_04 AC 155 ms
76,776 KB
testcase_05 AC 76 ms
75,852 KB
testcase_06 AC 78 ms
75,752 KB
testcase_07 AC 113 ms
76,316 KB
testcase_08 AC 124 ms
76,496 KB
testcase_09 AC 107 ms
76,376 KB
testcase_10 AC 85 ms
76,268 KB
testcase_11 AC 99 ms
76,264 KB
testcase_12 AC 99 ms
76,376 KB
testcase_13 AC 84 ms
76,276 KB
testcase_14 AC 82 ms
75,660 KB
testcase_15 AC 81 ms
75,696 KB
testcase_16 AC 123 ms
76,544 KB
testcase_17 AC 101 ms
76,276 KB
testcase_18 AC 130 ms
76,884 KB
testcase_19 AC 90 ms
76,348 KB
testcase_20 AC 162 ms
77,024 KB
testcase_21 AC 133 ms
76,600 KB
testcase_22 AC 111 ms
76,420 KB
testcase_23 AC 125 ms
76,596 KB
testcase_24 AC 137 ms
76,572 KB
testcase_25 AC 84 ms
76,344 KB
testcase_26 AC 138 ms
76,508 KB
testcase_27 AC 125 ms
76,404 KB
testcase_28 AC 185 ms
77,412 KB
testcase_29 AC 191 ms
77,380 KB
testcase_30 AC 188 ms
77,368 KB
testcase_31 AC 186 ms
77,392 KB
testcase_32 AC 193 ms
77,608 KB
testcase_33 AC 195 ms
77,644 KB
testcase_34 AC 194 ms
77,256 KB
testcase_35 AC 192 ms
77,408 KB
testcase_36 AC 193 ms
77,496 KB
testcase_37 AC 189 ms
77,432 KB
testcase_38 AC 192 ms
77,520 KB
testcase_39 AC 187 ms
77,568 KB
testcase_40 AC 191 ms
77,464 KB
testcase_41 AC 190 ms
77,428 KB
testcase_42 AC 189 ms
77,568 KB
testcase_43 AC 195 ms
77,312 KB
testcase_44 AC 189 ms
77,496 KB
testcase_45 AC 190 ms
77,304 KB
testcase_46 AC 194 ms
77,436 KB
testcase_47 AC 190 ms
77,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input():
	return sys.stdin.readline()[:-1]
n, m = map(int, input().split())
a = [sum(list(map(int, input().split()))) for _ in range(n)]
INF = 10**15
dp = [[-INF for _ in range(2)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(1, n+1):
	x = a[i-1]
	dp[i][0] = max(dp[i-1][0], dp[i-1][1] - x)
	dp[i][1] = max(dp[i-1][1], dp[i-1][0] + x)
print(max(dp[n]))
0