結果

問題 No.1199 お菓子配り-2
ユーザー raven7959raven7959
提出日時 2021-08-03 22:04:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 235 ms / 1,000 ms
コード長 346 bytes
コンパイル時間 1,917 ms
コンパイル使用メモリ 86,492 KB
実行使用メモリ 77,608 KB
最終ジャッジ日時 2023-10-14 21:10:55
合計ジャッジ時間 13,614 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
71,032 KB
testcase_01 AC 79 ms
71,260 KB
testcase_02 AC 88 ms
71,036 KB
testcase_03 AC 125 ms
76,432 KB
testcase_04 AC 178 ms
76,888 KB
testcase_05 AC 91 ms
75,696 KB
testcase_06 AC 87 ms
75,652 KB
testcase_07 AC 134 ms
76,176 KB
testcase_08 AC 149 ms
76,376 KB
testcase_09 AC 118 ms
76,476 KB
testcase_10 AC 101 ms
76,256 KB
testcase_11 AC 121 ms
76,360 KB
testcase_12 AC 121 ms
76,400 KB
testcase_13 AC 92 ms
76,120 KB
testcase_14 AC 104 ms
75,708 KB
testcase_15 AC 92 ms
75,476 KB
testcase_16 AC 153 ms
76,312 KB
testcase_17 AC 114 ms
76,304 KB
testcase_18 AC 165 ms
76,820 KB
testcase_19 AC 110 ms
76,084 KB
testcase_20 AC 198 ms
76,724 KB
testcase_21 AC 154 ms
76,624 KB
testcase_22 AC 140 ms
76,724 KB
testcase_23 AC 148 ms
76,688 KB
testcase_24 AC 171 ms
76,824 KB
testcase_25 AC 93 ms
76,308 KB
testcase_26 AC 170 ms
76,524 KB
testcase_27 AC 138 ms
76,336 KB
testcase_28 AC 232 ms
77,424 KB
testcase_29 AC 216 ms
77,428 KB
testcase_30 AC 233 ms
77,412 KB
testcase_31 AC 224 ms
77,088 KB
testcase_32 AC 234 ms
77,328 KB
testcase_33 AC 218 ms
77,404 KB
testcase_34 AC 235 ms
77,376 KB
testcase_35 AC 217 ms
77,420 KB
testcase_36 AC 234 ms
77,168 KB
testcase_37 AC 218 ms
77,352 KB
testcase_38 AC 232 ms
77,372 KB
testcase_39 AC 216 ms
77,444 KB
testcase_40 AC 231 ms
77,480 KB
testcase_41 AC 217 ms
77,252 KB
testcase_42 AC 233 ms
77,608 KB
testcase_43 AC 216 ms
77,288 KB
testcase_44 AC 232 ms
77,504 KB
testcase_45 AC 215 ms
77,424 KB
testcase_46 AC 233 ms
77,080 KB
testcase_47 AC 216 ms
77,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=[0]*N
for i in range(N):
    A[i]=sum(list(map(int,input().split())))
DP=[[0 for _ in range(4)] for _ in range(N+1)]
for i in range(N):
    DP[i+1][0]=max(DP[i][2],DP[i][3])+A[i]
    DP[i+1][1]=max(DP[i][0],DP[i][1])
    DP[i+1][2]=max(DP[i][0],DP[i][1])-A[i]
    DP[i+1][3]=max(DP[i][2],DP[i][3])
print(max(DP[N]))
0