結果

問題 No.921 ずんだアロー
ユーザー ptotqptotq
提出日時 2019-11-08 22:07:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 252 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 19,852 KB
最終ジャッジ日時 2023-10-13 03:52:58
合計ジャッジ時間 2,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,128 KB
testcase_01 AC 16 ms
8,096 KB
testcase_02 AC 16 ms
8,220 KB
testcase_03 AC 16 ms
8,132 KB
testcase_04 AC 16 ms
8,308 KB
testcase_05 AC 16 ms
8,228 KB
testcase_06 AC 17 ms
8,208 KB
testcase_07 AC 17 ms
8,180 KB
testcase_08 AC 17 ms
8,128 KB
testcase_09 AC 16 ms
8,144 KB
testcase_10 AC 165 ms
18,756 KB
testcase_11 AC 170 ms
19,320 KB
testcase_12 AC 49 ms
10,508 KB
testcase_13 AC 129 ms
16,188 KB
testcase_14 AC 144 ms
17,408 KB
testcase_15 AC 91 ms
13,548 KB
testcase_16 AC 27 ms
8,832 KB
testcase_17 AC 149 ms
17,564 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 178 ms
19,520 KB
testcase_24 AC 49 ms
19,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby
input()
_ = list(map(int, input().split()))
a = [len(tuple(v)) for _, v in groupby(_)]
N = len(a)
dp = [0]*(N+10)

for i in range(N):
    dp[i+1] = max(dp[i], dp[i+1])
    dp[i+2] = max(dp[i]+a[i], dp[i+2])

print(max(dp))
0