結果

問題 No.1053 ゲーミング棒
ユーザー GrayCoderGrayCoder
提出日時 2020-05-16 06:50:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 848 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 11,880 KB
実行使用メモリ 23,660 KB
最終ジャッジ日時 2023-10-21 17:28:52
合計ジャッジ時間 3,270 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,112 KB
testcase_01 AC 29 ms
10,112 KB
testcase_02 AC 29 ms
10,112 KB
testcase_03 AC 29 ms
10,112 KB
testcase_04 AC 28 ms
10,112 KB
testcase_05 AC 28 ms
10,112 KB
testcase_06 AC 29 ms
10,112 KB
testcase_07 AC 28 ms
10,112 KB
testcase_08 AC 28 ms
10,112 KB
testcase_09 AC 28 ms
10,112 KB
testcase_10 AC 29 ms
10,112 KB
testcase_11 AC 28 ms
10,112 KB
testcase_12 AC 28 ms
10,112 KB
testcase_13 AC 29 ms
10,112 KB
testcase_14 AC 28 ms
10,112 KB
testcase_15 AC 28 ms
10,112 KB
testcase_16 AC 28 ms
10,112 KB
testcase_17 AC 28 ms
10,112 KB
testcase_18 AC 29 ms
10,112 KB
testcase_19 AC 28 ms
10,112 KB
testcase_20 AC 28 ms
10,112 KB
testcase_21 AC 29 ms
10,112 KB
testcase_22 AC 28 ms
10,112 KB
testcase_23 AC 82 ms
23,660 KB
testcase_24 AC 84 ms
23,660 KB
testcase_25 AC 83 ms
23,660 KB
testcase_26 AC 83 ms
23,660 KB
testcase_27 RE -
testcase_28 AC 29 ms
10,116 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 52 ms
11,912 KB
testcase_32 AC 51 ms
11,912 KB
testcase_33 AC 51 ms
11,912 KB
testcase_34 AC 51 ms
11,912 KB
testcase_35 AC 56 ms
16,620 KB
testcase_36 AC 57 ms
17,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

'''
from math import gcd
from itertools import accumulate, combinations, permutations, product
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
from operator import add, mul, sub, truediv, floordiv, mod

from decimal import *
getcontext().prec = 500

import string
ascii = string.ascii_lowercase
'''
from collections import deque
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = tuple(map(int, input().split()))

    a1 = [A[0]]
    for i in range(1, N):
        if a1[-1] != A[i]:
            a1.append(A[i])

    a2 = deque(a1)
    for _ in [0] * len(a1):
        n = a2.popleft()
        if n != a2[-1]:
            a2.append(n)

    if len(set(a1)) != len(a2):
        print(-1)
    else:
        print(len(a1) - len(a2))


main()
0