結果

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

ソースコード

diff #

n=int(input())
if n==1:
    print(0)
    exit()
A=list(map(int,input().split()))
pre=-1
kouho=set([])
out=[]
for i in range(n):
    if A[i]==pre:
        continue
    if A[i] in kouho:
        out.append(A[i])
    kouho.add(A[i])
    pre=A[i]
if not out:
    if len(out)==1 and A[0]==A[-1]:
        print(1)
    else:
        print(-1)
else:
    print(0)
0