結果

問題 No.921 ずんだアロー
ユーザー paruf4paruf4
提出日時 2020-06-24 00:19:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 380 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 19,832 KB
最終ジャッジ日時 2023-09-16 20:21:04
合計ジャッジ時間 2,805 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,136 KB
testcase_01 AC 15 ms
8,108 KB
testcase_02 AC 14 ms
8,280 KB
testcase_03 AC 15 ms
8,192 KB
testcase_04 RE -
testcase_05 AC 14 ms
8,200 KB
testcase_06 AC 15 ms
8,184 KB
testcase_07 AC 15 ms
8,244 KB
testcase_08 AC 15 ms
8,132 KB
testcase_09 AC 15 ms
8,120 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 41 ms
10,564 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 74 ms
13,432 KB
testcase_16 AC 22 ms
8,864 KB
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 138 ms
19,644 KB
testcase_24 AC 49 ms
19,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
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)


0