結果

問題 No.921 ずんだアロー
ユーザー 👑 KazunKazun
提出日時 2020-12-09 04:09:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 297 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 105,140 KB
最終ジャッジ日時 2023-10-19 04:41:40
合計ジャッジ時間 3,383 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,232 KB
testcase_01 AC 39 ms
53,232 KB
testcase_02 AC 39 ms
53,232 KB
testcase_03 AC 39 ms
53,232 KB
testcase_04 AC 39 ms
53,232 KB
testcase_05 AC 38 ms
53,232 KB
testcase_06 AC 40 ms
53,232 KB
testcase_07 AC 39 ms
53,232 KB
testcase_08 AC 39 ms
53,232 KB
testcase_09 AC 39 ms
53,232 KB
testcase_10 AC 116 ms
102,544 KB
testcase_11 AC 105 ms
105,092 KB
testcase_12 AC 65 ms
79,636 KB
testcase_13 AC 90 ms
97,376 KB
testcase_14 AC 96 ms
100,360 KB
testcase_15 AC 78 ms
89,672 KB
testcase_16 AC 52 ms
68,320 KB
testcase_17 AC 98 ms
102,696 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 103 ms
105,140 KB
testcase_24 AC 63 ms
82,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))+["*"]

X=[]
l=0
k=A[0]
for r in range(N+1):
    if k!=A[r]:
        X.append(r-l)
        k=A[r]
        l=r

K=len(X)
DP=[[0,0] for _ in range(K+1)]

for i in range(1,K+1):
    DP[i][1]=DP[i-1][0]+X[i-1]
    DP[i][0]=max(DP[i-1])
print(max(DP[-1]))
0