結果

問題 No.1053 ゲーミング棒
ユーザー kamomekamome
提出日時 2020-05-15 22:56:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 518 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 11,840 KB
実行使用メモリ 33,016 KB
最終ジャッジ日時 2023-10-19 16:12:57
合計ジャッジ時間 5,825 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,076 KB
testcase_01 AC 29 ms
9,960 KB
testcase_02 AC 28 ms
9,960 KB
testcase_03 AC 27 ms
9,960 KB
testcase_04 AC 27 ms
9,960 KB
testcase_05 AC 28 ms
9,960 KB
testcase_06 AC 29 ms
9,960 KB
testcase_07 AC 28 ms
9,960 KB
testcase_08 AC 28 ms
9,960 KB
testcase_09 AC 28 ms
9,960 KB
testcase_10 AC 27 ms
9,960 KB
testcase_11 AC 27 ms
9,960 KB
testcase_12 AC 27 ms
9,960 KB
testcase_13 AC 27 ms
9,960 KB
testcase_14 AC 28 ms
9,960 KB
testcase_15 AC 27 ms
9,960 KB
testcase_16 AC 27 ms
9,960 KB
testcase_17 AC 27 ms
9,960 KB
testcase_18 AC 28 ms
9,960 KB
testcase_19 AC 28 ms
9,960 KB
testcase_20 AC 28 ms
9,960 KB
testcase_21 AC 27 ms
9,960 KB
testcase_22 AC 28 ms
9,960 KB
testcase_23 AC 177 ms
33,016 KB
testcase_24 AC 180 ms
33,016 KB
testcase_25 AC 175 ms
33,016 KB
testcase_26 AC 174 ms
33,016 KB
testcase_27 AC 27 ms
9,960 KB
testcase_28 AC 27 ms
9,960 KB
testcase_29 AC 28 ms
9,960 KB
testcase_30 TLE -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

input()
A=input().split()
#A=list(map(int,input().split()))
index=[ [] for x in range(len(A)) ]
index={"dummy":[]}
for i in range(len(A)):
    index[A[i]] = index[A[i]]+[i] if A[i] in index.keys() else [i]
    
gaps=0

for k in index.keys():
    prev=None
    for j in index[k]:
        if prev!=None:
            if j-prev != 1:
                gaps=gaps+1
        prev=j

if gaps >1:
    print(-1)
elif gaps==1 and A[0] != A[-1]:
    print(-1)
elif gaps==1 and A[0] == A[-1]:
    print(1)
elif gaps==0:
    print(0)
0