結果

問題 No.1053 ゲーミング棒
ユーザー 👑 timitimi
提出日時 2020-10-08 11:29:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 22,484 KB
最終ジャッジ日時 2023-09-27 11:46:51
合計ジャッジ時間 2,696 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,884 KB
testcase_01 AC 15 ms
7,944 KB
testcase_02 AC 15 ms
7,856 KB
testcase_03 AC 14 ms
7,808 KB
testcase_04 AC 16 ms
7,868 KB
testcase_05 AC 15 ms
7,812 KB
testcase_06 AC 15 ms
7,800 KB
testcase_07 AC 13 ms
7,916 KB
testcase_08 AC 14 ms
7,856 KB
testcase_09 AC 14 ms
7,800 KB
testcase_10 AC 14 ms
7,856 KB
testcase_11 AC 14 ms
7,876 KB
testcase_12 AC 13 ms
7,776 KB
testcase_13 AC 13 ms
7,832 KB
testcase_14 AC 12 ms
7,804 KB
testcase_15 AC 13 ms
7,880 KB
testcase_16 AC 14 ms
7,784 KB
testcase_17 AC 13 ms
7,884 KB
testcase_18 AC 14 ms
7,844 KB
testcase_19 AC 13 ms
7,816 KB
testcase_20 AC 12 ms
7,880 KB
testcase_21 AC 14 ms
7,884 KB
testcase_22 AC 13 ms
7,856 KB
testcase_23 AC 70 ms
22,240 KB
testcase_24 AC 73 ms
22,228 KB
testcase_25 AC 72 ms
22,484 KB
testcase_26 AC 74 ms
22,172 KB
testcase_27 AC 14 ms
8,168 KB
testcase_28 AC 14 ms
7,808 KB
testcase_29 AC 13 ms
8,172 KB
testcase_30 AC 45 ms
10,088 KB
testcase_31 AC 46 ms
10,052 KB
testcase_32 AC 45 ms
9,984 KB
testcase_33 AC 46 ms
9,996 KB
testcase_34 AC 46 ms
9,996 KB
testcase_35 AC 53 ms
14,684 KB
testcase_36 AC 49 ms
15,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
D=[A[0]]
for i in range(N-1):
    if A[i]!=A[i+1]:
        D.append(A[i+1])
if len(D)==1:
    print(0)
    exit()
if D[0]==D[-1]:
    D=D[1:]
    if len(D)==len(set(D)):
        print(1)
    else:
        print(-1)
else:
    if len(D)==len(set(D)):
        print(0)
    else:
        print(-1)
0