結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
ttr
|
| 提出日時 | 2020-06-03 20:22:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 430 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 20,688 KB |
| 最終ジャッジ日時 | 2024-11-25 10:01:57 |
| 合計ジャッジ時間 | 3,325 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
A = newA
ans = 0
num = [0]*(N+1)
for i in range(N):
if num[A[i]] == 0:
num[A[i]] += 1
elif A[i-1] == A[i]:
num[A[i]] += 1
elif i == N-1 and A[0] == A[i] and N > 1:
ans = 1
else:
ans = -1
break
print(ans)
ttr