結果

問題 No.1053 ゲーミング棒
ユーザー c-yan
提出日時 2020-05-15 22:17:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 25,440 KB
最終ジャッジ日時 2024-09-19 10:58:30
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

d = {}
prev = -1
for a in A:
    if prev != a:
        d.setdefault(a, 0)
        d[a] += 1
    prev = a

t = len([i for i in d.values() if i >= 2])
if t >= 2:
    print(-1)
elif t == 1:
    if A[0] == A[-1]:
        print(1)
    else:
        print(-1)
else:
    print(0)
0