結果

問題 No.921 ずんだアロー
ユーザー brthyyjp
提出日時 2020-03-15 19:23:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 82,048 KB
最終ジャッジ日時 2024-11-25 08:26:24
合計ジャッジ時間 2,818 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

e = 0
for i in range(n):
    if i%2 == 0:
        e += 1
    else:
        if i != n-1:
            if A[i-1] == A[i] and A[i] == A[i+1]:
                e += 1
        else:
            if A[i-1] == A[i]:
                e += 1

o = 0
for i in range(n):
    if i%2 == 1:
        o += 1
    else:
        if i == 0:
            if A[i] == A[i+1]:
                o += 1
        if i != n-1:
            if A[i-1] == A[i] and A[i] == A[i+1]:
                o += 1
        else:
            if A[i-1] == A[i]:
                o += 1

print(max(o, e))
0