結果

問題 No.921 ずんだアロー
ユーザー 👑 Kazun
提出日時 2020-12-09 04:38:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 85,120 KB
最終ジャッジ日時 2024-09-19 00:59:57
合計ジャッジ時間 2,325 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

DP=[0]*(N+1)
DP[1]=1

M=0
for i in range(2,N+1):
    M=max(M,DP[i-2])
    if A[i-1]==A[i]:
        DP[i]=DP[i-1]+1
    else:
        DP[i]=max(M+1,DP[i-1])
print(DP[-1])
0