結果

問題 No.1053 ゲーミング棒
ユーザー convexineqconvexineq
提出日時 2020-05-15 21:33:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 457 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 12,012 KB
実行使用メモリ 21,460 KB
最終ジャッジ日時 2023-10-19 13:08:56
合計ジャッジ時間 2,863 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,696 KB
testcase_01 AC 31 ms
10,696 KB
testcase_02 AC 32 ms
10,696 KB
testcase_03 AC 31 ms
10,696 KB
testcase_04 AC 32 ms
10,696 KB
testcase_05 AC 31 ms
10,696 KB
testcase_06 AC 32 ms
10,696 KB
testcase_07 AC 31 ms
10,696 KB
testcase_08 AC 31 ms
10,696 KB
testcase_09 AC 31 ms
10,696 KB
testcase_10 AC 32 ms
10,696 KB
testcase_11 AC 31 ms
10,696 KB
testcase_12 AC 32 ms
10,696 KB
testcase_13 AC 31 ms
10,696 KB
testcase_14 AC 30 ms
10,696 KB
testcase_15 AC 31 ms
10,696 KB
testcase_16 AC 31 ms
10,696 KB
testcase_17 AC 32 ms
10,696 KB
testcase_18 AC 32 ms
10,696 KB
testcase_19 AC 31 ms
10,696 KB
testcase_20 AC 31 ms
10,696 KB
testcase_21 AC 31 ms
10,696 KB
testcase_22 AC 31 ms
10,696 KB
testcase_23 AC 87 ms
21,456 KB
testcase_24 AC 90 ms
21,460 KB
testcase_25 AC 92 ms
21,460 KB
testcase_26 AC 90 ms
21,460 KB
testcase_27 AC 31 ms
10,696 KB
testcase_28 AC 30 ms
10,696 KB
testcase_29 AC 31 ms
10,696 KB
testcase_30 AC 55 ms
11,768 KB
testcase_31 AC 56 ms
11,768 KB
testcase_32 AC 55 ms
11,768 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 61 ms
16,848 KB
testcase_36 AC 62 ms
16,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline 

n,*a = list(map(int,read().split()))

res = [0]*(10**5+3)
now = 10**6

two = 0
for i in a:
    if i != now:
        res[i] += 1        
        if res[i]==2: two += 1
        now = i

if two >= 2:
    print(-1)
elif two == 1:
    if a[0] == a[-1] == res.index(2):
        print(1)
    else:
        print(-1)
elif two==0:
    print(0)

#print(res[:5],two)


0