結果
| 問題 | No.1053 ゲーミング棒 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-23 15:04:37 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 412 bytes |
| 記録 | |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 95,728 KB |
| 実行使用メモリ | 111,872 KB |
| 最終ジャッジ日時 | 2026-08-03 08:57:06 |
| 合計ジャッジ時間 | 4,738 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)