結果

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

ソースコード

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

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