結果
問題 |
No.1053 ゲーミング棒
|
ユーザー |
![]() |
提出日時 | 2020-05-16 12:10:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 20,880 KB |
最終ジャッジ日時 | 2024-09-22 04:48:53 |
合計ジャッジ時間 | 7,253 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 TLE * 1 -- * 9 |
ソースコード
# coding: utf-8 from collections import deque N = int(input()) A = list(map(int,input().split())) A = deque(A) cnt = 0 while True: a1 = A.popleft() if a1 == A[-1]: A.append(a1) cnt += 1 else: A = deque([a1]) + A break #print(A) L = [False] * (N+1) a = [A[0]] for i in range(N-1): if A[i+1] != A[i]: a.append(A[i+1]) #print(A) flg = True for i in range(len(a)): if L[a[i]]: flg = False else: L[a[i]] = True if flg: print(cnt) else: print(-1)