結果

問題 No.1199 お菓子配り-2
ユーザー daikisuyamadaikisuyama
提出日時 2020-08-28 21:37:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 1,000 ms
コード長 293 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 77,600 KB
最終ジャッジ日時 2023-08-08 22:21:07
合計ジャッジ時間 11,440 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,240 KB
testcase_01 AC 68 ms
71,308 KB
testcase_02 AC 69 ms
71,224 KB
testcase_03 AC 116 ms
76,272 KB
testcase_04 AC 156 ms
76,948 KB
testcase_05 AC 75 ms
75,680 KB
testcase_06 AC 77 ms
75,960 KB
testcase_07 AC 113 ms
76,260 KB
testcase_08 AC 125 ms
76,376 KB
testcase_09 AC 107 ms
76,328 KB
testcase_10 AC 83 ms
76,260 KB
testcase_11 AC 100 ms
76,304 KB
testcase_12 AC 102 ms
76,388 KB
testcase_13 AC 81 ms
76,260 KB
testcase_14 AC 85 ms
75,808 KB
testcase_15 AC 80 ms
75,676 KB
testcase_16 AC 125 ms
76,628 KB
testcase_17 AC 104 ms
76,240 KB
testcase_18 AC 134 ms
76,600 KB
testcase_19 AC 93 ms
76,276 KB
testcase_20 AC 169 ms
76,968 KB
testcase_21 AC 139 ms
76,896 KB
testcase_22 AC 114 ms
76,596 KB
testcase_23 AC 128 ms
76,716 KB
testcase_24 AC 143 ms
76,672 KB
testcase_25 AC 87 ms
76,268 KB
testcase_26 AC 142 ms
76,680 KB
testcase_27 AC 128 ms
76,464 KB
testcase_28 AC 199 ms
77,444 KB
testcase_29 AC 199 ms
77,552 KB
testcase_30 AC 202 ms
77,348 KB
testcase_31 AC 197 ms
77,256 KB
testcase_32 AC 198 ms
77,512 KB
testcase_33 AC 197 ms
77,440 KB
testcase_34 AC 200 ms
77,600 KB
testcase_35 AC 199 ms
77,448 KB
testcase_36 AC 193 ms
77,424 KB
testcase_37 AC 192 ms
77,308 KB
testcase_38 AC 191 ms
77,452 KB
testcase_39 AC 192 ms
77,468 KB
testcase_40 AC 197 ms
77,532 KB
testcase_41 AC 196 ms
77,576 KB
testcase_42 AC 194 ms
77,416 KB
testcase_43 AC 197 ms
77,576 KB
testcase_44 AC 198 ms
77,564 KB
testcase_45 AC 192 ms
77,448 KB
testcase_46 AC 193 ms
77,552 KB
testcase_47 AC 196 ms
77,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=[sum(list(map(int,input().split()))) for i in range(n)]
dp=[[0,0] for i in range(n)]
dp[0][0]=a[0]
for i in range(n-1):
    #食べるか食べないか
    dp[i+1][0]=max(dp[i][0],dp[i][1]+a[i+1])
    dp[i+1][1]=max(dp[i][1],dp[i][0]-a[i+1])
print(max(dp[n-1]))
0