結果
問題 | No.921 ずんだアロー |
ユーザー |
![]() |
提出日時 | 2020-06-24 00:24:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,016 KB |
最終ジャッジ日時 | 2024-07-03 19:36:59 |
合計ジャッジ時間 | 2,729 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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=[] if len(l)==1: print(l[0]) exit(0) 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)