結果

問題 No.1053 ゲーミング棒
ユーザー ttrttr
提出日時 2020-06-03 20:25:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 442 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 20,684 KB
最終ジャッジ日時 2024-05-04 03:37:11
合計ジャッジ時間 2,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 26 ms
10,624 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 26 ms
10,624 KB
testcase_04 AC 26 ms
10,624 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 26 ms
10,624 KB
testcase_09 AC 25 ms
10,624 KB
testcase_10 RE -
testcase_11 AC 26 ms
10,624 KB
testcase_12 AC 26 ms
10,624 KB
testcase_13 RE -
testcase_14 AC 25 ms
10,624 KB
testcase_15 AC 27 ms
10,624 KB
testcase_16 AC 26 ms
10,752 KB
testcase_17 AC 26 ms
10,752 KB
testcase_18 AC 25 ms
10,752 KB
testcase_19 AC 26 ms
10,752 KB
testcase_20 AC 25 ms
10,624 KB
testcase_21 AC 26 ms
10,624 KB
testcase_22 AC 27 ms
10,752 KB
testcase_23 AC 109 ms
20,556 KB
testcase_24 AC 111 ms
20,560 KB
testcase_25 AC 105 ms
20,684 KB
testcase_26 AC 113 ms
20,680 KB
testcase_27 AC 25 ms
10,624 KB
testcase_28 AC 26 ms
10,624 KB
testcase_29 AC 26 ms
10,752 KB
testcase_30 AC 65 ms
12,664 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(a) for a in input().split()]

newA = [A[0]]
for i in range(1, N):
    if newA[-1] == A[i]:
        continue
    newA.append(A[i])

N = len(newA)
ans = 0
num = [0]*(N+1)
for i in range(N):
    if num[newA[i]] == 0:
        num[newA[i]] += 1
    elif newA[i-1] == newA[i]:
        num[newA[i]] += 1
    elif i == N-1 and newA[0] == newA[i] and N > 1:
        ans = 1
    else:
        ans = -1
        break
print(ans)
0