結果

問題 No.1053 ゲーミング棒
ユーザー toyuzukotoyuzuko
提出日時 2020-06-04 22:30:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 30,020 KB
最終ジャッジ日時 2023-08-20 07:56:50
合計ジャッジ時間 3,415 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,552 KB
testcase_01 AC 19 ms
8,452 KB
testcase_02 AC 18 ms
8,596 KB
testcase_03 AC 18 ms
8,608 KB
testcase_04 AC 18 ms
8,452 KB
testcase_05 AC 18 ms
8,436 KB
testcase_06 AC 18 ms
8,512 KB
testcase_07 AC 18 ms
8,508 KB
testcase_08 AC 18 ms
8,584 KB
testcase_09 AC 18 ms
8,612 KB
testcase_10 AC 18 ms
8,416 KB
testcase_11 AC 18 ms
8,448 KB
testcase_12 AC 18 ms
8,600 KB
testcase_13 AC 18 ms
8,440 KB
testcase_14 AC 19 ms
8,460 KB
testcase_15 AC 19 ms
8,440 KB
testcase_16 AC 18 ms
8,580 KB
testcase_17 AC 18 ms
8,468 KB
testcase_18 AC 18 ms
8,560 KB
testcase_19 AC 19 ms
8,420 KB
testcase_20 AC 18 ms
8,436 KB
testcase_21 AC 18 ms
8,584 KB
testcase_22 AC 18 ms
8,492 KB
testcase_23 AC 121 ms
29,872 KB
testcase_24 AC 121 ms
29,948 KB
testcase_25 AC 120 ms
30,020 KB
testcase_26 AC 123 ms
29,872 KB
testcase_27 AC 18 ms
8,484 KB
testcase_28 AC 19 ms
8,444 KB
testcase_29 AC 19 ms
8,460 KB
testcase_30 AC 57 ms
10,244 KB
testcase_31 AC 49 ms
10,252 KB
testcase_32 AC 42 ms
10,376 KB
testcase_33 AC 47 ms
10,424 KB
testcase_34 AC 47 ms
10,264 KB
testcase_35 AC 54 ms
14,940 KB
testcase_36 AC 55 ms
15,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from itertools import groupby

N = int(input())
A = list(map(int, input().split()))

def solve(arr):
    c = Counter(arr)
    g = tuple(groupby(arr))
    if len(c) == len(g):
        return True
    return False

flag = 0

while A and A[-1] == A[0]:
    A.pop()
    flag = 1
    if not A:
        flag = 0

if solve(A):
    print(int(flag))
else:
    print(-1)
0