結果
問題 | No.1053 ゲーミング棒 |
ユーザー |
![]() |
提出日時 | 2020-05-15 21:34:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 124 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 24,360 KB |
最終ジャッジ日時 | 2024-09-19 09:16:48 |
合計ジャッジ時間 | 2,547 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
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] else: break 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)