結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
ttr
|
| 提出日時 | 2020-06-03 20:25:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 442 bytes |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 20,684 KB |
| 最終ジャッジ日時 | 2024-11-25 10:10:12 |
| 合計ジャッジ時間 | 3,191 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 RE * 11 |
ソースコード
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)
ttr