結果

問題 No.1199 お菓子配り-2
ユーザー daikisuyamadaikisuyama
提出日時 2020-08-28 21:37:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 1,000 ms
コード長 293 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,544 KB
最終ジャッジ日時 2024-04-26 14:30:02
合計ジャッジ時間 9,299 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,712 KB
testcase_01 AC 35 ms
51,808 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 76 ms
75,360 KB
testcase_04 AC 113 ms
76,160 KB
testcase_05 AC 47 ms
62,208 KB
testcase_06 AC 44 ms
65,536 KB
testcase_07 AC 88 ms
75,512 KB
testcase_08 AC 94 ms
75,264 KB
testcase_09 AC 76 ms
74,956 KB
testcase_10 AC 51 ms
72,704 KB
testcase_11 AC 66 ms
75,276 KB
testcase_12 AC 65 ms
75,136 KB
testcase_13 AC 50 ms
73,120 KB
testcase_14 AC 50 ms
71,040 KB
testcase_15 AC 47 ms
68,608 KB
testcase_16 AC 89 ms
75,608 KB
testcase_17 AC 67 ms
75,136 KB
testcase_18 AC 101 ms
75,476 KB
testcase_19 AC 62 ms
75,520 KB
testcase_20 AC 132 ms
76,032 KB
testcase_21 AC 108 ms
75,824 KB
testcase_22 AC 82 ms
75,740 KB
testcase_23 AC 97 ms
75,392 KB
testcase_24 AC 101 ms
75,776 KB
testcase_25 AC 54 ms
75,392 KB
testcase_26 AC 105 ms
75,648 KB
testcase_27 AC 93 ms
75,600 KB
testcase_28 AC 153 ms
76,032 KB
testcase_29 AC 151 ms
76,416 KB
testcase_30 AC 148 ms
76,160 KB
testcase_31 AC 155 ms
76,160 KB
testcase_32 AC 160 ms
75,936 KB
testcase_33 AC 148 ms
76,032 KB
testcase_34 AC 153 ms
76,160 KB
testcase_35 AC 156 ms
76,000 KB
testcase_36 AC 150 ms
76,416 KB
testcase_37 AC 171 ms
76,184 KB
testcase_38 AC 157 ms
76,416 KB
testcase_39 AC 153 ms
76,256 KB
testcase_40 AC 150 ms
76,544 KB
testcase_41 AC 162 ms
76,376 KB
testcase_42 AC 158 ms
75,816 KB
testcase_43 AC 151 ms
76,472 KB
testcase_44 AC 154 ms
75,996 KB
testcase_45 AC 159 ms
76,128 KB
testcase_46 AC 157 ms
75,812 KB
testcase_47 AC 161 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=[sum(list(map(int,input().split()))) for i in range(n)]
dp=[[0,0] for i in range(n)]
dp[0][0]=a[0]
for i in range(n-1):
    #食べるか食べないか
    dp[i+1][0]=max(dp[i][0],dp[i][1]+a[i+1])
    dp[i+1][1]=max(dp[i][1],dp[i][0]-a[i+1])
print(max(dp[n-1]))
0