結果

問題 No.1053 ゲーミング棒
コンテスト
ユーザー ああいい
提出日時 2022-02-23 15:04:16
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 401 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 190 ms
コンパイル使用メモリ 84,992 KB
実行使用メモリ 96,384 KB
最終ジャッジ日時 2026-03-22 17:04:44
合計ジャッジ時間 2,683 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 12 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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()
0