結果

問題 No.1199 お菓子配り-2
ユーザー rei60rei60
提出日時 2020-08-30 15:55:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 1,000 ms
コード長 311 bytes
コンパイル時間 654 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 76,664 KB
最終ジャッジ日時 2024-04-27 09:28:12
合計ジャッジ時間 14,745 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,060 KB
testcase_01 AC 41 ms
52,496 KB
testcase_02 AC 44 ms
52,744 KB
testcase_03 AC 115 ms
75,496 KB
testcase_04 AC 128 ms
75,952 KB
testcase_05 AC 50 ms
64,252 KB
testcase_06 AC 48 ms
66,916 KB
testcase_07 AC 88 ms
75,460 KB
testcase_08 AC 110 ms
75,236 KB
testcase_09 AC 93 ms
75,424 KB
testcase_10 AC 55 ms
73,308 KB
testcase_11 AC 75 ms
75,656 KB
testcase_12 AC 76 ms
75,444 KB
testcase_13 AC 56 ms
73,292 KB
testcase_14 AC 57 ms
72,804 KB
testcase_15 AC 53 ms
69,720 KB
testcase_16 AC 106 ms
75,872 KB
testcase_17 AC 83 ms
75,240 KB
testcase_18 AC 113 ms
75,556 KB
testcase_19 AC 71 ms
75,292 KB
testcase_20 AC 152 ms
76,244 KB
testcase_21 AC 123 ms
75,856 KB
testcase_22 AC 104 ms
75,868 KB
testcase_23 AC 104 ms
75,848 KB
testcase_24 AC 119 ms
76,012 KB
testcase_25 AC 62 ms
75,388 KB
testcase_26 AC 118 ms
75,396 KB
testcase_27 AC 104 ms
75,596 KB
testcase_28 AC 172 ms
76,320 KB
testcase_29 AC 182 ms
76,460 KB
testcase_30 AC 170 ms
76,168 KB
testcase_31 AC 167 ms
76,664 KB
testcase_32 AC 165 ms
76,464 KB
testcase_33 AC 174 ms
76,068 KB
testcase_34 AC 176 ms
76,288 KB
testcase_35 AC 172 ms
76,616 KB
testcase_36 AC 171 ms
76,104 KB
testcase_37 AC 167 ms
76,128 KB
testcase_38 AC 169 ms
76,512 KB
testcase_39 AC 177 ms
76,404 KB
testcase_40 AC 173 ms
76,184 KB
testcase_41 AC 173 ms
76,560 KB
testcase_42 AC 218 ms
76,040 KB
testcase_43 AC 188 ms
76,524 KB
testcase_44 AC 177 ms
76,388 KB
testcase_45 AC 180 ms
76,560 KB
testcase_46 AC 175 ms
76,608 KB
testcase_47 AC 171 ms
76,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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