結果
問題 |
No.921 ずんだアロー
|
ユーザー |
|
提出日時 | 2022-08-14 19:58:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 420 bytes |
コンパイル時間 | 275 ms |
コンパイル使用メモリ | 82,640 KB |
実行使用メモリ | 77,364 KB |
最終ジャッジ日時 | 2024-10-01 11:08:56 |
合計ジャッジ時間 | 3,309 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 13 WA * 9 |
ソースコード
n = int(input()) a = [int(i) for i in input().split()] now = 10**9 li = [0]*n for i in range(n-1): if a[i] == a[i+1]: li[i] = 1 li[i+1] = 1 else: continue idx = 0 for i in range(n): if idx+1 >= n: break if li[idx] == 0 and li[idx+1] == 0: li[idx] = 1 idx += 2 else: idx += 1 if li[n-2] == 0 and li[n-1] == 0: li[n-1] = 1 print(sum(li))