結果

問題 No.1199 お菓子配り-2
ユーザー 双六双六
提出日時 2020-08-30 03:04:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 1,000 ms
コード長 510 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 85,636 KB
実行使用メモリ 77,628 KB
最終ジャッジ日時 2023-08-09 10:42:43
合計ジャッジ時間 14,276 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,384 KB
testcase_01 AC 101 ms
71,556 KB
testcase_02 AC 103 ms
71,300 KB
testcase_03 AC 159 ms
76,868 KB
testcase_04 AC 162 ms
77,112 KB
testcase_05 AC 106 ms
76,916 KB
testcase_06 AC 111 ms
76,596 KB
testcase_07 AC 133 ms
76,724 KB
testcase_08 AC 143 ms
77,024 KB
testcase_09 AC 129 ms
76,900 KB
testcase_10 AC 113 ms
76,616 KB
testcase_11 AC 124 ms
76,868 KB
testcase_12 AC 127 ms
76,984 KB
testcase_13 AC 113 ms
76,784 KB
testcase_14 AC 112 ms
76,676 KB
testcase_15 AC 112 ms
76,544 KB
testcase_16 AC 146 ms
77,120 KB
testcase_17 AC 125 ms
76,768 KB
testcase_18 AC 151 ms
76,852 KB
testcase_19 AC 122 ms
76,760 KB
testcase_20 AC 172 ms
77,104 KB
testcase_21 AC 153 ms
76,944 KB
testcase_22 AC 137 ms
76,864 KB
testcase_23 AC 143 ms
76,912 KB
testcase_24 AC 152 ms
77,160 KB
testcase_25 AC 114 ms
76,652 KB
testcase_26 AC 157 ms
77,148 KB
testcase_27 AC 150 ms
77,000 KB
testcase_28 AC 203 ms
77,316 KB
testcase_29 AC 194 ms
77,184 KB
testcase_30 AC 198 ms
77,356 KB
testcase_31 AC 198 ms
77,320 KB
testcase_32 AC 197 ms
77,288 KB
testcase_33 AC 205 ms
77,396 KB
testcase_34 AC 201 ms
77,396 KB
testcase_35 AC 198 ms
77,316 KB
testcase_36 AC 192 ms
77,312 KB
testcase_37 AC 197 ms
77,184 KB
testcase_38 AC 197 ms
77,180 KB
testcase_39 AC 199 ms
77,388 KB
testcase_40 AC 199 ms
77,280 KB
testcase_41 AC 199 ms
77,392 KB
testcase_42 AC 194 ms
77,316 KB
testcase_43 AC 195 ms
77,436 KB
testcase_44 AC 203 ms
77,396 KB
testcase_45 AC 204 ms
77,340 KB
testcase_46 AC 197 ms
77,284 KB
testcase_47 AC 198 ms
77,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	DP = [[0, 0] for i in range(N + 1)]
	DP[0][1] = -INF
	for i in range(N):
		A = getlist()
		S = sum(A)
		DP[i + 1][0] = max(DP[i][0], DP[i][1] - S)
		DP[i + 1][1] = max(DP[i][0] + S, DP[i][1])

	ans = max(DP[-1])
	print(ans)

if __name__ == '__main__':
	main()
0