結果

問題 No.1053 ゲーミング棒
コンテスト
ユーザー hir355
提出日時 2020-05-15 21:35:10
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 350 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 287 ms
コンパイル使用メモリ 21,472 KB
実行使用メモリ 23,696 KB
最終ジャッジ日時 2026-08-30 23:18:43
合計ジャッジ時間 6,102 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
a = list(map(int, input().split()))
idx = 0
while idx < n and a[idx] == a[-1]:
    a.append(a[0])
    idx += 1
s = set([a[idx]])
for i in range(idx, n - 1 + idx):
    if a[i] != a[i + 1]:
        if a[i + 1] in s:
            print(-1)
            break
else:
    if idx == 0 or idx == n:
        print(0)
    else:
        print(1)
0