結果

問題 No.921 ずんだアロー
ユーザー hedwig100hedwig100
提出日時 2020-04-10 13:47:30
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 20,216 KB
最終ジャッジ日時 2023-10-13 02:32:05
合計ジャッジ時間 2,601 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,632 KB
testcase_01 AC 19 ms
8,656 KB
testcase_02 AC 19 ms
8,608 KB
testcase_03 AC 19 ms
8,592 KB
testcase_04 AC 19 ms
8,652 KB
testcase_05 AC 19 ms
8,704 KB
testcase_06 AC 19 ms
8,704 KB
testcase_07 AC 19 ms
8,548 KB
testcase_08 AC 19 ms
8,552 KB
testcase_09 AC 19 ms
8,744 KB
testcase_10 AC 54 ms
19,268 KB
testcase_11 AC 57 ms
19,728 KB
testcase_12 AC 27 ms
10,864 KB
testcase_13 AC 46 ms
16,708 KB
testcase_14 AC 50 ms
17,720 KB
testcase_15 AC 36 ms
13,760 KB
testcase_16 AC 21 ms
9,296 KB
testcase_17 AC 50 ms
17,780 KB
testcase_18 AC 65 ms
20,108 KB
testcase_19 AC 64 ms
20,096 KB
testcase_20 AC 64 ms
20,076 KB
testcase_21 AC 65 ms
20,140 KB
testcase_22 AC 65 ms
20,216 KB
testcase_23 AC 57 ms
19,892 KB
testcase_24 AC 64 ms
20,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()  
0