結果
問題 | No.921 ずんだアロー |
ユーザー | paruf4 |
提出日時 | 2020-06-24 00:24:21 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
RE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 10,916 KB |
実行使用メモリ | 19,856 KB |
最終ジャッジ日時 | 2023-09-16 20:21:53 |
合計ジャッジ時間 | 2,763 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
8,192 KB |
testcase_01 | AC | 16 ms
8,276 KB |
testcase_02 | AC | 15 ms
8,316 KB |
testcase_03 | AC | 16 ms
8,148 KB |
testcase_04 | RE | - |
testcase_05 | AC | 16 ms
8,152 KB |
testcase_06 | AC | 16 ms
8,176 KB |
testcase_07 | AC | 16 ms
8,312 KB |
testcase_08 | AC | 16 ms
8,244 KB |
testcase_09 | AC | 16 ms
8,208 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | AC | 41 ms
10,432 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | AC | 74 ms
13,468 KB |
testcase_16 | AC | 22 ms
8,856 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,564 KB |
testcase_24 | AC | 47 ms
19,840 KB |
ソースコード
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)