結果

問題 No.1199 お菓子配り-2
ユーザー marroncastlemarroncastle
提出日時 2020-08-28 22:22:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 775 ms / 1,000 ms
コード長 327 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,452 KB
最終ジャッジ日時 2024-04-26 15:00:00
合計ジャッジ時間 36,629 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 492 ms
43,944 KB
testcase_01 AC 505 ms
44,296 KB
testcase_02 AC 503 ms
44,072 KB
testcase_03 AC 548 ms
43,952 KB
testcase_04 AC 647 ms
44,204 KB
testcase_05 AC 487 ms
44,204 KB
testcase_06 AC 488 ms
43,824 KB
testcase_07 AC 553 ms
44,076 KB
testcase_08 AC 593 ms
43,816 KB
testcase_09 AC 575 ms
43,948 KB
testcase_10 AC 526 ms
43,824 KB
testcase_11 AC 548 ms
44,076 KB
testcase_12 AC 539 ms
43,948 KB
testcase_13 AC 509 ms
44,332 KB
testcase_14 AC 507 ms
44,196 KB
testcase_15 AC 518 ms
43,948 KB
testcase_16 AC 603 ms
43,952 KB
testcase_17 AC 545 ms
43,816 KB
testcase_18 AC 611 ms
43,816 KB
testcase_19 AC 519 ms
43,816 KB
testcase_20 AC 686 ms
44,200 KB
testcase_21 AC 609 ms
44,452 KB
testcase_22 AC 565 ms
44,204 KB
testcase_23 AC 611 ms
43,944 KB
testcase_24 AC 615 ms
44,076 KB
testcase_25 AC 514 ms
44,452 KB
testcase_26 AC 622 ms
43,820 KB
testcase_27 AC 599 ms
44,200 KB
testcase_28 AC 746 ms
43,820 KB
testcase_29 AC 736 ms
44,204 KB
testcase_30 AC 771 ms
44,080 KB
testcase_31 AC 755 ms
43,820 KB
testcase_32 AC 758 ms
43,820 KB
testcase_33 AC 766 ms
44,080 KB
testcase_34 AC 773 ms
43,820 KB
testcase_35 AC 768 ms
44,084 KB
testcase_36 AC 775 ms
44,204 KB
testcase_37 AC 757 ms
43,944 KB
testcase_38 AC 762 ms
43,828 KB
testcase_39 AC 775 ms
43,956 KB
testcase_40 AC 762 ms
44,200 KB
testcase_41 AC 765 ms
43,816 KB
testcase_42 AC 766 ms
44,204 KB
testcase_43 AC 767 ms
43,824 KB
testcase_44 AC 763 ms
44,076 KB
testcase_45 AC 762 ms
43,948 KB
testcase_46 AC 767 ms
44,212 KB
testcase_47 AC 752 ms
43,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
N, M = map(int, input().split())
A = [sum(map(int, input().split())) for _ in range(N)]
dp1 = A[:]
dp2 = [0]*N
if N>1:
  dp1[1] = max(dp1[1],dp1[0])
  dp2[1] = dp1[0]-A[1]
for i in range(2,N):
  dp1[i] = max([dp1[i],dp1[i-1],dp2[i-1]+A[i]])
  dp2[i] = max(dp1[i-1]-A[i],dp2[i-1])
print(max(dp1[-1],dp2[-1]))
0