結果

問題 No.921 ずんだアロー
ユーザー hedwig100hedwig100
提出日時 2020-04-10 13:46:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 530 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 20,256 KB
最終ジャッジ日時 2023-10-13 02:30:35
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,524 KB
testcase_01 AC 19 ms
8,592 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 19 ms
8,712 KB
testcase_05 AC 19 ms
8,496 KB
testcase_06 RE -
testcase_07 AC 19 ms
8,716 KB
testcase_08 AC 19 ms
8,648 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 27 ms
10,860 KB
testcase_13 RE -
testcase_14 AC 51 ms
17,796 KB
testcase_15 AC 37 ms
14,092 KB
testcase_16 AC 21 ms
9,308 KB
testcase_17 RE -
testcase_18 AC 67 ms
20,236 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 68 ms
20,256 KB
testcase_23 RE -
testcase_24 AC 70 ms
20,032 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 + 1:
        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