結果

問題 No.1199 お菓子配り-2
ユーザー kohei2019kohei2019
提出日時 2020-12-20 03:55:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 258 ms / 1,000 ms
コード長 405 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 11,908 KB
実行使用メモリ 10,452 KB
最終ジャッジ日時 2023-10-21 10:20:05
合計ジャッジ時間 11,101 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,096 KB
testcase_01 AC 27 ms
10,096 KB
testcase_02 AC 27 ms
10,096 KB
testcase_03 AC 82 ms
10,272 KB
testcase_04 AC 162 ms
10,364 KB
testcase_05 AC 32 ms
10,228 KB
testcase_06 AC 33 ms
10,220 KB
testcase_07 AC 101 ms
10,296 KB
testcase_08 AC 119 ms
10,348 KB
testcase_09 AC 78 ms
10,316 KB
testcase_10 AC 40 ms
10,240 KB
testcase_11 AC 71 ms
10,284 KB
testcase_12 AC 66 ms
10,360 KB
testcase_13 AC 41 ms
10,244 KB
testcase_14 AC 37 ms
10,192 KB
testcase_15 AC 36 ms
10,196 KB
testcase_16 AC 110 ms
10,376 KB
testcase_17 AC 67 ms
10,276 KB
testcase_18 AC 117 ms
10,328 KB
testcase_19 AC 50 ms
10,200 KB
testcase_20 AC 183 ms
10,404 KB
testcase_21 AC 131 ms
10,372 KB
testcase_22 AC 80 ms
10,296 KB
testcase_23 AC 105 ms
10,328 KB
testcase_24 AC 133 ms
10,360 KB
testcase_25 AC 44 ms
10,228 KB
testcase_26 AC 142 ms
10,396 KB
testcase_27 AC 125 ms
10,372 KB
testcase_28 AC 248 ms
10,440 KB
testcase_29 AC 244 ms
10,440 KB
testcase_30 AC 239 ms
10,416 KB
testcase_31 AC 237 ms
10,424 KB
testcase_32 AC 251 ms
10,440 KB
testcase_33 AC 239 ms
10,432 KB
testcase_34 AC 244 ms
10,432 KB
testcase_35 AC 247 ms
10,436 KB
testcase_36 AC 246 ms
10,424 KB
testcase_37 AC 241 ms
10,436 KB
testcase_38 AC 243 ms
10,440 KB
testcase_39 AC 243 ms
10,440 KB
testcase_40 AC 246 ms
10,440 KB
testcase_41 AC 248 ms
10,408 KB
testcase_42 AC 243 ms
10,416 KB
testcase_43 AC 235 ms
10,432 KB
testcase_44 AC 249 ms
10,432 KB
testcase_45 AC 242 ms
10,452 KB
testcase_46 AC 245 ms
10,432 KB
testcase_47 AC 258 ms
10,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
lsA = [0]
for i in range(N):
    lsA.append(sum(list(map(int,input().split()))))
#dp[i][j]=i番目までの最大値とったのが偶数番目奇数番目か(j=0,1)
dp = [[0,0] for i in range(N+1)]
dp[0][1] = -float('INF')
for i in range(1,N+1):
    dp[i][0] = max(dp[i-1][1]-lsA[i],dp[i-1][0])
    dp[i][1] = max(dp[i-1][0]+lsA[i],dp[i-1][1])
print(max(dp[N][0],dp[N][1]))
0