結果

問題 No.921 ずんだアロー
ユーザー ptotqptotq
提出日時 2019-11-08 22:05:16
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 264 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 19,836 KB
最終ジャッジ日時 2023-10-13 03:52:44
合計ジャッジ時間 3,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,136 KB
testcase_01 AC 16 ms
8,136 KB
testcase_02 AC 16 ms
8,280 KB
testcase_03 AC 16 ms
8,104 KB
testcase_04 AC 16 ms
8,224 KB
testcase_05 AC 16 ms
8,172 KB
testcase_06 AC 16 ms
8,368 KB
testcase_07 AC 16 ms
8,240 KB
testcase_08 AC 16 ms
8,236 KB
testcase_09 AC 16 ms
8,184 KB
testcase_10 AC 161 ms
18,900 KB
testcase_11 AC 170 ms
19,332 KB
testcase_12 AC 50 ms
10,860 KB
testcase_13 AC 128 ms
16,140 KB
testcase_14 AC 141 ms
17,308 KB
testcase_15 AC 92 ms
13,532 KB
testcase_16 AC 27 ms
8,944 KB
testcase_17 AC 147 ms
17,632 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 174 ms
19,704 KB
testcase_24 AC 49 ms
19,768 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[N], dp[N+1]))
0