結果

問題 No.1053 ゲーミング棒
ユーザー trineutron
提出日時 2020-05-16 10:50:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 20,856 KB
最終ジャッジ日時 2024-09-22 02:50:03
合計ジャッジ時間 3,420 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
s = [0] * n
s[a[0] - 1] = 1
for i in range(n - 1):
    if a[i + 1] != a[i]:
        s[a[i + 1] - 1] += 1
if a[0] == a[-1]:
    if n - s.count(0) - s.count(1) > 1:
        print(-1)
    else:
        print(1)
else:
    if n - s.count(0) - s.count(1) > 0:
        print(-1)
    else:
        print(0)
0