結果

問題 No.1199 お菓子配り-2
ユーザー NoaSaberNoaSaber
提出日時 2021-04-08 14:39:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 201 ms / 1,000 ms
コード長 367 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 78,276 KB
最終ジャッジ日時 2023-09-05 22:53:01
合計ジャッジ時間 15,796 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,452 KB
testcase_01 AC 67 ms
71,236 KB
testcase_02 AC 67 ms
71,432 KB
testcase_03 AC 106 ms
77,224 KB
testcase_04 AC 157 ms
77,824 KB
testcase_05 AC 71 ms
75,824 KB
testcase_06 AC 75 ms
75,816 KB
testcase_07 AC 109 ms
76,524 KB
testcase_08 AC 119 ms
76,760 KB
testcase_09 AC 101 ms
76,356 KB
testcase_10 AC 78 ms
75,700 KB
testcase_11 AC 96 ms
76,360 KB
testcase_12 AC 95 ms
76,416 KB
testcase_13 AC 79 ms
75,904 KB
testcase_14 AC 78 ms
75,708 KB
testcase_15 AC 78 ms
75,788 KB
testcase_16 AC 119 ms
76,488 KB
testcase_17 AC 98 ms
76,272 KB
testcase_18 AC 134 ms
77,692 KB
testcase_19 AC 91 ms
76,372 KB
testcase_20 AC 161 ms
77,824 KB
testcase_21 AC 139 ms
77,728 KB
testcase_22 AC 116 ms
77,472 KB
testcase_23 AC 126 ms
77,236 KB
testcase_24 AC 136 ms
77,572 KB
testcase_25 AC 79 ms
75,788 KB
testcase_26 AC 138 ms
77,192 KB
testcase_27 AC 121 ms
76,620 KB
testcase_28 AC 201 ms
78,180 KB
testcase_29 AC 188 ms
78,092 KB
testcase_30 AC 187 ms
78,184 KB
testcase_31 AC 186 ms
78,196 KB
testcase_32 AC 190 ms
78,068 KB
testcase_33 AC 188 ms
78,020 KB
testcase_34 AC 195 ms
78,060 KB
testcase_35 AC 189 ms
78,144 KB
testcase_36 AC 195 ms
77,904 KB
testcase_37 AC 188 ms
78,056 KB
testcase_38 AC 190 ms
78,156 KB
testcase_39 AC 189 ms
78,164 KB
testcase_40 AC 191 ms
78,276 KB
testcase_41 AC 186 ms
78,140 KB
testcase_42 AC 189 ms
78,220 KB
testcase_43 AC 188 ms
77,860 KB
testcase_44 AC 189 ms
78,096 KB
testcase_45 AC 188 ms
78,064 KB
testcase_46 AC 189 ms
77,848 KB
testcase_47 AC 189 ms
78,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
l=[]
inf=float("inf")
dp=[[-inf]*(2) for i in range(N+1)]
for i in range(N):
    tmp=map( int,input().split())
    l.append(sum(tmp))
dp[0][0]=0
for i in range(N):
    for j in range(2):
        dp[i+1][j]=max(dp[i][j],dp[i+1][j])
    dp[i+1][1]=max(dp[i+1][0]+l[i],dp[i+1][1])
    dp[i+1][0]=max(dp[i][1]-l[i],dp[i+1][0])
print(dp[N][1])
0