結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-23 15:04:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 412 bytes |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 82,440 KB |
| 実行使用メモリ | 98,584 KB |
| 最終ジャッジ日時 | 2024-07-01 14:45:38 |
| 合計ジャッジ時間 | 3,203 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 20 WA * 14 |
ソースコード
import sys
N = int(input())
A = list(map(int,input().split()))
ans = 0
while A and A[-1] == A[0]:
A.pop()
if not A:
print(0)
exit()
ans = 1
s =set()
left = 0
while left < len(A):
if A[left] not in s:
s.add(A[left])
right = left
while right < len(A) and A[right] == A[left]:
right += 1
left = right
else:
print(-1)
exit()
print(ans)