結果

問題 No.1199 お菓子配り-2
ユーザー flippergoflippergo
提出日時 2021-01-05 00:31:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 1,000 ms
コード長 399 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,576 KB
最終ジャッジ日時 2024-04-23 09:16:14
合計ジャッジ時間 12,850 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,224 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 36 ms
52,096 KB
testcase_03 AC 96 ms
75,136 KB
testcase_04 AC 149 ms
75,520 KB
testcase_05 AC 44 ms
62,720 KB
testcase_06 AC 45 ms
66,028 KB
testcase_07 AC 85 ms
75,176 KB
testcase_08 AC 97 ms
75,392 KB
testcase_09 AC 79 ms
75,136 KB
testcase_10 AC 55 ms
73,088 KB
testcase_11 AC 72 ms
75,216 KB
testcase_12 AC 72 ms
75,596 KB
testcase_13 AC 54 ms
73,344 KB
testcase_14 AC 51 ms
71,068 KB
testcase_15 AC 50 ms
68,728 KB
testcase_16 AC 98 ms
75,588 KB
testcase_17 AC 76 ms
75,376 KB
testcase_18 AC 104 ms
75,360 KB
testcase_19 AC 66 ms
75,136 KB
testcase_20 AC 135 ms
75,884 KB
testcase_21 AC 108 ms
75,264 KB
testcase_22 AC 90 ms
75,392 KB
testcase_23 AC 101 ms
75,264 KB
testcase_24 AC 109 ms
75,436 KB
testcase_25 AC 56 ms
74,880 KB
testcase_26 AC 112 ms
75,136 KB
testcase_27 AC 94 ms
75,512 KB
testcase_28 AC 152 ms
76,320 KB
testcase_29 AC 160 ms
76,296 KB
testcase_30 AC 165 ms
76,152 KB
testcase_31 AC 159 ms
76,160 KB
testcase_32 AC 155 ms
76,136 KB
testcase_33 AC 155 ms
76,344 KB
testcase_34 AC 161 ms
76,200 KB
testcase_35 AC 154 ms
76,160 KB
testcase_36 AC 159 ms
76,416 KB
testcase_37 AC 158 ms
76,576 KB
testcase_38 AC 164 ms
76,416 KB
testcase_39 AC 152 ms
76,416 KB
testcase_40 AC 149 ms
76,032 KB
testcase_41 AC 151 ms
76,416 KB
testcase_42 AC 160 ms
76,544 KB
testcase_43 AC 160 ms
76,416 KB
testcase_44 AC 154 ms
76,192 KB
testcase_45 AC 152 ms
76,344 KB
testcase_46 AC 155 ms
76,160 KB
testcase_47 AC 154 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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