結果
問題 |
No.1053 ゲーミング棒
|
ユーザー |
![]() |
提出日時 | 2020-10-08 11:29:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 342 bytes |
コンパイル時間 | 116 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 24,440 KB |
最終ジャッジ日時 | 2024-07-20 05:52:58 |
合計ジャッジ時間 | 2,524 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
N=int(input()) A=list(map(int, input().split())) D=[A[0]] for i in range(N-1): if A[i]!=A[i+1]: D.append(A[i+1]) if len(D)==1: print(0) exit() if D[0]==D[-1]: D=D[1:] if len(D)==len(set(D)): print(1) else: print(-1) else: if len(D)==len(set(D)): print(0) else: print(-1)