結果
| 問題 |
No.1053 ゲーミング棒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-18 00:14:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 580 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 112,768 KB |
| 最終ジャッジ日時 | 2024-06-30 00:49:40 |
| 合計ジャッジ時間 | 3,467 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
N = int(input())
lsA = list(map(int,input().split()))
used = set()
st = lsA[0]
f = True
for i in range(1,N):
if st == lsA[i]:
continue
else:
if lsA[i] in used:
f = False
used.add(st)
st = lsA[i]
if f:
print(0)
exit()
en = lsA[-1]
ll = []
while lsA and lsA[-1] == en:
ll.append(lsA.pop())
lsB = ll + lsA
used = set()
st = lsB[0]
for i in range(1,N):
if st == lsB[i]:
continue
else:
if lsB[i] in used:
print(-1)
exit()
used.add(st)
st = lsB[i]
print(1)