結果

問題 No.1199 お菓子配り-2
ユーザー roarisroaris
提出日時 2020-08-28 21:24:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 1,000 ms
コード長 322 bytes
コンパイル時間 797 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 78,492 KB
最終ジャッジ日時 2023-08-08 22:05:59
合計ジャッジ時間 11,129 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,636 KB
testcase_01 AC 75 ms
71,724 KB
testcase_02 AC 74 ms
71,684 KB
testcase_03 AC 105 ms
77,524 KB
testcase_04 AC 138 ms
77,176 KB
testcase_05 AC 84 ms
76,908 KB
testcase_06 AC 82 ms
76,800 KB
testcase_07 AC 107 ms
77,084 KB
testcase_08 AC 117 ms
77,176 KB
testcase_09 AC 102 ms
77,032 KB
testcase_10 AC 86 ms
76,732 KB
testcase_11 AC 99 ms
77,020 KB
testcase_12 AC 98 ms
77,028 KB
testcase_13 AC 86 ms
76,848 KB
testcase_14 AC 89 ms
76,760 KB
testcase_15 AC 94 ms
76,808 KB
testcase_16 AC 120 ms
77,160 KB
testcase_17 AC 103 ms
76,976 KB
testcase_18 AC 130 ms
77,228 KB
testcase_19 AC 94 ms
76,908 KB
testcase_20 AC 150 ms
77,812 KB
testcase_21 AC 139 ms
77,216 KB
testcase_22 AC 106 ms
77,028 KB
testcase_23 AC 115 ms
77,136 KB
testcase_24 AC 126 ms
76,988 KB
testcase_25 AC 86 ms
76,952 KB
testcase_26 AC 128 ms
77,232 KB
testcase_27 AC 136 ms
77,104 KB
testcase_28 AC 175 ms
77,980 KB
testcase_29 AC 177 ms
77,936 KB
testcase_30 AC 173 ms
78,204 KB
testcase_31 AC 166 ms
78,108 KB
testcase_32 AC 179 ms
77,852 KB
testcase_33 AC 175 ms
78,096 KB
testcase_34 AC 173 ms
78,232 KB
testcase_35 AC 181 ms
78,104 KB
testcase_36 AC 170 ms
78,188 KB
testcase_37 AC 169 ms
78,068 KB
testcase_38 AC 170 ms
78,020 KB
testcase_39 AC 168 ms
77,944 KB
testcase_40 AC 167 ms
77,896 KB
testcase_41 AC 169 ms
77,992 KB
testcase_42 AC 165 ms
78,008 KB
testcase_43 AC 169 ms
78,108 KB
testcase_44 AC 170 ms
78,340 KB
testcase_45 AC 169 ms
78,040 KB
testcase_46 AC 169 ms
78,492 KB
testcase_47 AC 168 ms
78,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, M = map(int, input().split())
A = [sum(list(map(int, input().split()))) for _ in range(N)]
dp = [[0]*2 for _ in range(N+1)]

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

print(max(dp[N]))
0