結果

問題 No.1199 お菓子配り-2
ユーザー tonnnura172tonnnura172
提出日時 2020-10-21 20:39:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 255 ms / 1,000 ms
コード長 999 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 10,044 KB
最終ジャッジ日時 2023-09-28 14:22:49
合計ジャッジ時間 17,723 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,612 KB
testcase_01 AC 29 ms
9,488 KB
testcase_02 AC 29 ms
9,420 KB
testcase_03 AC 86 ms
9,668 KB
testcase_04 AC 169 ms
9,760 KB
testcase_05 AC 33 ms
9,728 KB
testcase_06 AC 37 ms
9,684 KB
testcase_07 AC 96 ms
9,668 KB
testcase_08 AC 122 ms
9,876 KB
testcase_09 AC 85 ms
9,632 KB
testcase_10 AC 44 ms
9,744 KB
testcase_11 AC 72 ms
9,824 KB
testcase_12 AC 72 ms
9,724 KB
testcase_13 AC 43 ms
9,588 KB
testcase_14 AC 42 ms
9,616 KB
testcase_15 AC 40 ms
9,564 KB
testcase_16 AC 120 ms
9,820 KB
testcase_17 AC 74 ms
9,680 KB
testcase_18 AC 126 ms
9,852 KB
testcase_19 AC 55 ms
9,648 KB
testcase_20 AC 197 ms
9,896 KB
testcase_21 AC 136 ms
9,908 KB
testcase_22 AC 87 ms
9,836 KB
testcase_23 AC 110 ms
9,704 KB
testcase_24 AC 139 ms
9,792 KB
testcase_25 AC 45 ms
9,680 KB
testcase_26 AC 149 ms
9,780 KB
testcase_27 AC 127 ms
9,848 KB
testcase_28 AC 252 ms
9,988 KB
testcase_29 AC 251 ms
9,992 KB
testcase_30 AC 251 ms
9,864 KB
testcase_31 AC 251 ms
10,044 KB
testcase_32 AC 250 ms
9,824 KB
testcase_33 AC 253 ms
9,876 KB
testcase_34 AC 255 ms
9,924 KB
testcase_35 AC 250 ms
10,016 KB
testcase_36 AC 250 ms
9,824 KB
testcase_37 AC 251 ms
9,792 KB
testcase_38 AC 250 ms
9,820 KB
testcase_39 AC 250 ms
9,992 KB
testcase_40 AC 251 ms
9,916 KB
testcase_41 AC 253 ms
9,848 KB
testcase_42 AC 252 ms
9,968 KB
testcase_43 AC 251 ms
9,792 KB
testcase_44 AC 251 ms
9,984 KB
testcase_45 AC 250 ms
9,788 KB
testcase_46 AC 251 ms
9,820 KB
testcase_47 AC 252 ms
9,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = [sum(LIST()) for _ in range(N)]

dp = [[0]*2 for _ in range(N+1)]

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

print(dp[-1][1])
0