結果

問題 No.921 ずんだアロー
ユーザー TS_KAsTS_KAs
提出日時 2019-11-08 23:07:26
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 92,748 KB
最終ジャッジ日時 2023-10-13 04:46:13
合計ジャッジ時間 4,004 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,364 KB
testcase_01 AC 73 ms
71,204 KB
testcase_02 AC 73 ms
71,328 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 74 ms
71,396 KB
testcase_07 AC 73 ms
71,340 KB
testcase_08 AC 74 ms
71,096 KB
testcase_09 AC 73 ms
71,500 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 81 ms
77,800 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 88 ms
83,136 KB
testcase_16 AC 79 ms
76,412 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 97 ms
92,588 KB
testcase_24 AC 95 ms
92,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [0] + list(map(int, input().split())) + [0]
ans = 0
X = 0
Y = 0
for i in range(N+1):
    if A[i] != A[i+1]:
        X += 1
        if Y >= 2:
            ans += Y+1
            Y = 0
        else:
            Y = 0
    if A[i] == A[i+1]:
        Y += 1
        if X > 2:
            ans += abs(X-2)//2
        X = 0
if X == N + 1:
    print(X//2)
else:
    print(ans)
    
        
0