結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-16 06:50:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 848 bytes |
| コンパイル時間 | 116 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 24,972 KB |
| 最終ジャッジ日時 | 2024-09-21 18:43:35 |
| 合計ジャッジ時間 | 2,997 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 RE * 3 |
ソースコード
'''
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()