結果

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

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=[False]*N
P=0
if len(set(A))==1:
  print(0)
  exit()
if A[0]==A[-1]:
  for i in range(N-1,-1,-1):
    if A[0]==A[i]:
      del A[i]
  P=1
for i in range(len(A)-1):
  B[A[i]-1]=True
  if B[A[i+1]-1] and (A[i]!=A[i+1]):
    print(-1)
    exit()
print(P)
0