結果

問題 No.921 ずんだアロー
ユーザー hedwig100hedwig100
提出日時 2020-04-10 13:05:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 634 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 20,228 KB
最終ジャッジ日時 2023-10-13 00:59:38
合計ジャッジ時間 2,892 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,560 KB
testcase_01 WA -
testcase_02 AC 19 ms
8,588 KB
testcase_03 AC 19 ms
8,704 KB
testcase_04 AC 19 ms
8,708 KB
testcase_05 AC 19 ms
8,592 KB
testcase_06 AC 20 ms
8,608 KB
testcase_07 AC 19 ms
8,712 KB
testcase_08 AC 19 ms
8,688 KB
testcase_09 AC 19 ms
8,588 KB
testcase_10 AC 56 ms
19,196 KB
testcase_11 WA -
testcase_12 AC 28 ms
10,972 KB
testcase_13 AC 48 ms
16,688 KB
testcase_14 AC 51 ms
17,676 KB
testcase_15 AC 38 ms
13,936 KB
testcase_16 AC 21 ms
9,324 KB
testcase_17 AC 52 ms
18,492 KB
testcase_18 AC 67 ms
20,132 KB
testcase_19 AC 67 ms
20,056 KB
testcase_20 WA -
testcase_21 AC 66 ms
20,132 KB
testcase_22 AC 66 ms
20,108 KB
testcase_23 AC 60 ms
20,020 KB
testcase_24 AC 66 ms
20,228 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()))
    a = [a[0]] + a + [a[-1]]

    ans = (n + 1)//2
    cnt1 = (n + 1)//2
    cnt2 = n//2
    for i in range(1,n + 1):
        if i%2 == 0:
            if a[i - 1] == a[i] == a[i + 1]:
                cnt2 += 1
        else:
            if a[i - 1] == a[i] == a[i + 1]:
                cnt1 += 1
    ans = max(ans,cnt1,cnt2)
    print(ans)

if __name__ =='__main__':
    main()  
0