結果

問題 No.921 ずんだアロー
ユーザー TS_KAsTS_KAs
提出日時 2019-11-08 23:05:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 2,796 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 93,816 KB
最終ジャッジ日時 2023-10-13 04:42:11
合計ジャッジ時間 3,850 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,196 KB
testcase_01 WA -
testcase_02 AC 70 ms
71,064 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 70 ms
71,484 KB
testcase_07 AC 68 ms
71,480 KB
testcase_08 AC 72 ms
71,256 KB
testcase_09 AC 71 ms
71,312 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 77 ms
77,796 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 85 ms
83,128 KB
testcase_16 AC 76 ms
76,316 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 98 ms
92,476 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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]:
        print('Y')
        Y += 1
        if X > 2:
            ans += abs(X-2)//2
        X = 0
if X == N + 1:
    print(X//2)
else:
    print(ans)
    
        
0