結果

問題 No.1199 お菓子配り-2
ユーザー anagohirameanagohirame
提出日時 2020-08-28 21:42:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 1,000 ms
コード長 371 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 76,796 KB
最終ジャッジ日時 2024-04-26 14:34:22
合計ジャッジ時間 9,383 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,440 KB
testcase_01 AC 35 ms
52,872 KB
testcase_02 AC 37 ms
52,796 KB
testcase_03 AC 78 ms
75,168 KB
testcase_04 AC 119 ms
75,424 KB
testcase_05 AC 43 ms
63,072 KB
testcase_06 AC 45 ms
66,692 KB
testcase_07 AC 82 ms
75,600 KB
testcase_08 AC 91 ms
75,228 KB
testcase_09 AC 75 ms
75,580 KB
testcase_10 AC 52 ms
72,548 KB
testcase_11 AC 70 ms
75,376 KB
testcase_12 AC 68 ms
75,564 KB
testcase_13 AC 50 ms
73,560 KB
testcase_14 AC 50 ms
71,404 KB
testcase_15 AC 48 ms
69,200 KB
testcase_16 AC 93 ms
75,544 KB
testcase_17 AC 70 ms
75,564 KB
testcase_18 AC 98 ms
75,348 KB
testcase_19 AC 63 ms
75,300 KB
testcase_20 AC 133 ms
75,616 KB
testcase_21 AC 103 ms
75,272 KB
testcase_22 AC 79 ms
75,612 KB
testcase_23 AC 89 ms
75,368 KB
testcase_24 AC 102 ms
75,764 KB
testcase_25 AC 56 ms
75,108 KB
testcase_26 AC 108 ms
75,912 KB
testcase_27 AC 94 ms
75,436 KB
testcase_28 AC 160 ms
76,420 KB
testcase_29 AC 161 ms
76,352 KB
testcase_30 AC 159 ms
76,736 KB
testcase_31 AC 159 ms
76,068 KB
testcase_32 AC 158 ms
76,512 KB
testcase_33 AC 158 ms
76,360 KB
testcase_34 AC 158 ms
75,872 KB
testcase_35 AC 158 ms
76,340 KB
testcase_36 AC 159 ms
76,404 KB
testcase_37 AC 157 ms
76,180 KB
testcase_38 AC 155 ms
76,000 KB
testcase_39 AC 156 ms
76,312 KB
testcase_40 AC 160 ms
76,196 KB
testcase_41 AC 157 ms
76,108 KB
testcase_42 AC 154 ms
76,304 KB
testcase_43 AC 154 ms
76,796 KB
testcase_44 AC 165 ms
76,412 KB
testcase_45 AC 155 ms
76,292 KB
testcase_46 AC 158 ms
76,132 KB
testcase_47 AC 156 ms
76,272 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