結果
| 問題 | 
                            No.921 ずんだアロー
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-04-10 13:47:30 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 79 ms / 2,000 ms | 
| コード長 | 526 bytes | 
| コンパイル時間 | 246 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 20,888 KB | 
| 最終ジャッジ日時 | 2024-09-15 00:15:59 | 
| 合計ジャッジ時間 | 2,658 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque
from heapq import heapify,heappush,heappop
def main():
    n = int(input())
    a = list(map(int,input().split())) + [-1]
    ans = (n + 1)//2
    cnt = 0
    i = 0
    while i < n:
        if a[i] == a[i + 1]:
            i += 1
            cnt += 1
        else:
            i += 2
            cnt += 1 
    ans = max(ans,cnt)
    print(ans)
if __name__ =='__main__':
    main()