結果

問題 No.1199 お菓子配り-2
ユーザー ああいいああいい
提出日時 2022-03-04 13:25:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 230 ms / 1,000 ms
コード長 308 bytes
コンパイル時間 1,273 ms
コンパイル使用メモリ 86,528 KB
実行使用メモリ 85,928 KB
最終ジャッジ日時 2023-09-25 13:11:05
合計ジャッジ時間 18,748 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,172 KB
testcase_01 AC 77 ms
71,000 KB
testcase_02 AC 80 ms
71,184 KB
testcase_03 AC 123 ms
77,568 KB
testcase_04 AC 180 ms
82,240 KB
testcase_05 AC 86 ms
75,608 KB
testcase_06 AC 90 ms
75,724 KB
testcase_07 AC 127 ms
78,284 KB
testcase_08 AC 141 ms
79,340 KB
testcase_09 AC 119 ms
78,536 KB
testcase_10 AC 94 ms
76,720 KB
testcase_11 AC 110 ms
77,540 KB
testcase_12 AC 111 ms
77,788 KB
testcase_13 AC 93 ms
76,712 KB
testcase_14 AC 91 ms
75,608 KB
testcase_15 AC 89 ms
75,624 KB
testcase_16 AC 139 ms
79,232 KB
testcase_17 AC 114 ms
77,668 KB
testcase_18 AC 149 ms
79,828 KB
testcase_19 AC 104 ms
76,672 KB
testcase_20 AC 186 ms
82,944 KB
testcase_21 AC 156 ms
80,648 KB
testcase_22 AC 128 ms
78,088 KB
testcase_23 AC 141 ms
79,016 KB
testcase_24 AC 155 ms
80,496 KB
testcase_25 AC 97 ms
76,980 KB
testcase_26 AC 158 ms
80,972 KB
testcase_27 AC 141 ms
79,104 KB
testcase_28 AC 220 ms
85,908 KB
testcase_29 AC 220 ms
85,840 KB
testcase_30 AC 224 ms
85,880 KB
testcase_31 AC 229 ms
85,756 KB
testcase_32 AC 225 ms
85,780 KB
testcase_33 AC 220 ms
85,632 KB
testcase_34 AC 226 ms
85,868 KB
testcase_35 AC 213 ms
85,712 KB
testcase_36 AC 220 ms
85,908 KB
testcase_37 AC 219 ms
85,928 KB
testcase_38 AC 230 ms
85,688 KB
testcase_39 AC 228 ms
85,564 KB
testcase_40 AC 229 ms
85,884 KB
testcase_41 AC 224 ms
85,916 KB
testcase_42 AC 221 ms
85,864 KB
testcase_43 AC 219 ms
85,596 KB
testcase_44 AC 221 ms
85,624 KB
testcase_45 AC 221 ms
85,608 KB
testcase_46 AC 229 ms
85,868 KB
testcase_47 AC 222 ms
85,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
B = [sum(A[i]) for i in range(N)]

dp = [[0] * 2 for _ in range(N)]
dp[0][1] = B[0]
for i in range(1,N):
    dp[i][0] = max(dp[i-1][1] - B[i],dp[i-1][0])
    dp[i][1] = max(dp[i-1][0] + B[i],dp[i-1][1])
print(max(dp[-1]))
0