結果

問題 No.1199 お菓子配り-2
ユーザー O2MTO2MT
提出日時 2020-12-16 00:02:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 1,000 ms
コード長 334 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 75,752 KB
最終ジャッジ日時 2023-10-20 07:03:54
合計ジャッジ時間 11,252 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,608 KB
testcase_01 AC 40 ms
51,592 KB
testcase_02 AC 40 ms
51,612 KB
testcase_03 AC 105 ms
74,504 KB
testcase_04 AC 145 ms
75,220 KB
testcase_05 AC 51 ms
62,000 KB
testcase_06 AC 55 ms
65,332 KB
testcase_07 AC 99 ms
74,820 KB
testcase_08 AC 112 ms
74,880 KB
testcase_09 AC 92 ms
74,768 KB
testcase_10 AC 65 ms
72,408 KB
testcase_11 AC 86 ms
74,744 KB
testcase_12 AC 84 ms
74,728 KB
testcase_13 AC 64 ms
72,820 KB
testcase_14 AC 64 ms
70,612 KB
testcase_15 AC 61 ms
68,124 KB
testcase_16 AC 113 ms
74,944 KB
testcase_17 AC 90 ms
74,756 KB
testcase_18 AC 123 ms
75,008 KB
testcase_19 AC 80 ms
74,740 KB
testcase_20 AC 156 ms
75,468 KB
testcase_21 AC 127 ms
75,048 KB
testcase_22 AC 101 ms
74,960 KB
testcase_23 AC 114 ms
74,952 KB
testcase_24 AC 128 ms
75,080 KB
testcase_25 AC 71 ms
74,668 KB
testcase_26 AC 131 ms
74,976 KB
testcase_27 AC 116 ms
74,884 KB
testcase_28 AC 190 ms
75,684 KB
testcase_29 AC 177 ms
75,740 KB
testcase_30 AC 191 ms
75,696 KB
testcase_31 AC 190 ms
75,692 KB
testcase_32 AC 191 ms
75,680 KB
testcase_33 AC 187 ms
75,748 KB
testcase_34 AC 189 ms
75,656 KB
testcase_35 AC 186 ms
75,752 KB
testcase_36 AC 192 ms
75,744 KB
testcase_37 AC 187 ms
75,692 KB
testcase_38 AC 184 ms
75,664 KB
testcase_39 AC 185 ms
75,752 KB
testcase_40 AC 186 ms
75,668 KB
testcase_41 AC 185 ms
75,692 KB
testcase_42 AC 185 ms
75,644 KB
testcase_43 AC 185 ms
75,720 KB
testcase_44 AC 187 ms
75,656 KB
testcase_45 AC 186 ms
75,692 KB
testcase_46 AC 187 ms
75,744 KB
testcase_47 AC 187 ms
75,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = []
for _ in range(N):
    A.append(sum(list(map(int,input().split()))))
ans = max(A)
if N == 1:
    print(ans)
    exit()
dp = [[0 for _ in range(2)] for _ in range(N+1)]
for i in range(N):
    dp[i+1][0] = max(dp[i][1]+A[i], dp[i][0])
    dp[i+1][1] = max(dp[i][0]-A[i],dp[i][1])

print(max(dp[N]))
0