結果

問題 No.921 ずんだアロー
ユーザー hedwig100hedwig100
提出日時 2020-04-10 13:09:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 20,136 KB
最終ジャッジ日時 2023-10-13 01:12:53
合計ジャッジ時間 2,573 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,500 KB
testcase_01 AC 20 ms
8,524 KB
testcase_02 AC 19 ms
8,500 KB
testcase_03 AC 19 ms
8,648 KB
testcase_04 AC 19 ms
8,608 KB
testcase_05 AC 19 ms
8,624 KB
testcase_06 AC 19 ms
8,580 KB
testcase_07 AC 20 ms
8,668 KB
testcase_08 AC 19 ms
8,656 KB
testcase_09 AC 19 ms
8,684 KB
testcase_10 AC 56 ms
19,192 KB
testcase_11 WA -
testcase_12 AC 28 ms
10,916 KB
testcase_13 AC 48 ms
16,660 KB
testcase_14 AC 52 ms
17,684 KB
testcase_15 AC 38 ms
14,068 KB
testcase_16 AC 22 ms
9,348 KB
testcase_17 AC 52 ms
18,432 KB
testcase_18 AC 66 ms
20,100 KB
testcase_19 AC 67 ms
20,132 KB
testcase_20 WA -
testcase_21 AC 67 ms
20,136 KB
testcase_22 AC 67 ms
20,028 KB
testcase_23 AC 60 ms
19,900 KB
testcase_24 AC 67 ms
20,124 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]:
                cnt1 += 1
        else:
            if a[i - 1] == a[i] == a[i + 1]:
                cnt2 += 1
    ans = max(ans,cnt1,cnt2)
    print(ans)

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