結果

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

ソースコード

diff #

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

index=set()
gapped=[]
prev=-1
for i in range(len(A)):
    if prev !=A[i]:
        if A[i] in index:
            gapped.append(A[i])
        else:
            index.add(A[i])
    prev=A[i]
    
if len(gapped)>1:
    print(-1)
elif A[0] != A[-1] and len(gapped)>0:
    print(-1)
elif len(gapped)==0:
    print(0)
elif A[0] != A[-1] and len(gapped)==1:
    print(1)
else:
    print(-1)
0