結果

問題 No.921 ずんだアロー
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-15 19:23:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 82,176 KB
最終ジャッジ日時 2024-05-04 02:19:50
合計ジャッジ時間 2,328 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,968 KB
testcase_01 AC 33 ms
51,712 KB
testcase_02 AC 33 ms
51,968 KB
testcase_03 AC 33 ms
51,968 KB
testcase_04 AC 33 ms
52,352 KB
testcase_05 AC 33 ms
51,840 KB
testcase_06 AC 34 ms
51,840 KB
testcase_07 AC 34 ms
51,968 KB
testcase_08 AC 33 ms
52,096 KB
testcase_09 AC 34 ms
52,224 KB
testcase_10 AC 56 ms
78,592 KB
testcase_11 WA -
testcase_12 AC 45 ms
64,384 KB
testcase_13 AC 55 ms
74,880 KB
testcase_14 AC 55 ms
76,800 KB
testcase_15 AC 52 ms
69,888 KB
testcase_16 AC 46 ms
61,056 KB
testcase_17 AC 60 ms
78,336 KB
testcase_18 AC 62 ms
82,176 KB
testcase_19 AC 64 ms
81,792 KB
testcase_20 WA -
testcase_21 AC 64 ms
81,408 KB
testcase_22 AC 63 ms
81,664 KB
testcase_23 AC 57 ms
81,408 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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