結果
| 問題 |
No.921 ずんだアロー
|
| コンテスト | |
| ユーザー |
paruf4
|
| 提出日時 | 2020-06-24 00:21:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 411 bytes |
| コンパイル時間 | 78 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 21,012 KB |
| 最終ジャッジ日時 | 2024-07-03 19:36:20 |
| 合計ジャッジ時間 | 2,668 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 5 RE * 6 |
ソースコード
n=int(input())
a=list(map(int,input().split()))
if n==1:
print(1)
exit(0)
from itertools import groupby
gr=groupby(a)
l=[]
for k,g in gr:
l.append(len(list(g)))
ans=0
t=0
m=[]
for i in range(len(l)):
if l[i]>1:
ans+=l[i]
m.append(t)
t=0
else:
if i>0 and l[i-1]>1:continue
if i<n-1 and l[i+1]>1:continue
t+=1
if t!=0:
m.append(t)
for mm in m:
ans+=(mm+2-1)//2
print(ans)
paruf4