結果

問題 No.1199 お菓子配り-2
ユーザー 双六双六
提出日時 2020-08-30 03:04:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 1,000 ms
コード長 510 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 76,576 KB
最終ジャッジ日時 2024-04-27 01:30:01
合計ジャッジ時間 8,946 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,096 KB
testcase_01 AC 40 ms
54,804 KB
testcase_02 AC 40 ms
53,868 KB
testcase_03 AC 76 ms
75,816 KB
testcase_04 AC 110 ms
76,056 KB
testcase_05 AC 46 ms
64,700 KB
testcase_06 AC 51 ms
66,244 KB
testcase_07 AC 77 ms
75,616 KB
testcase_08 AC 89 ms
75,940 KB
testcase_09 AC 73 ms
76,028 KB
testcase_10 AC 52 ms
71,652 KB
testcase_11 AC 69 ms
75,676 KB
testcase_12 AC 68 ms
75,616 KB
testcase_13 AC 51 ms
72,816 KB
testcase_14 AC 51 ms
71,108 KB
testcase_15 AC 50 ms
69,008 KB
testcase_16 AC 86 ms
75,672 KB
testcase_17 AC 70 ms
76,040 KB
testcase_18 AC 92 ms
75,888 KB
testcase_19 AC 62 ms
75,812 KB
testcase_20 AC 117 ms
75,888 KB
testcase_21 AC 96 ms
75,688 KB
testcase_22 AC 75 ms
75,624 KB
testcase_23 AC 87 ms
75,568 KB
testcase_24 AC 97 ms
76,024 KB
testcase_25 AC 53 ms
73,352 KB
testcase_26 AC 100 ms
75,680 KB
testcase_27 AC 90 ms
75,880 KB
testcase_28 AC 141 ms
76,180 KB
testcase_29 AC 138 ms
76,576 KB
testcase_30 AC 140 ms
76,280 KB
testcase_31 AC 140 ms
76,368 KB
testcase_32 AC 142 ms
76,188 KB
testcase_33 AC 141 ms
76,540 KB
testcase_34 AC 140 ms
76,420 KB
testcase_35 AC 142 ms
76,480 KB
testcase_36 AC 140 ms
76,528 KB
testcase_37 AC 142 ms
76,116 KB
testcase_38 AC 140 ms
76,496 KB
testcase_39 AC 140 ms
76,436 KB
testcase_40 AC 140 ms
76,124 KB
testcase_41 AC 141 ms
76,456 KB
testcase_42 AC 144 ms
76,352 KB
testcase_43 AC 140 ms
76,044 KB
testcase_44 AC 147 ms
76,072 KB
testcase_45 AC 141 ms
76,368 KB
testcase_46 AC 142 ms
76,180 KB
testcase_47 AC 144 ms
76,452 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