結果
問題 |
No.1053 ゲーミング棒
|
ユーザー |
|
提出日時 | 2022-02-23 15:04:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 401 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,400 KB |
実行使用メモリ | 96,960 KB |
最終ジャッジ日時 | 2024-07-01 14:44:57 |
合計ジャッジ時間 | 3,640 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 12 WA * 22 |
ソースコード
import sys N = int(input()) A = list(map(int,input().split())) ans = 0 while A and A[-1] == A[0]: A.pop() if not A: print(0) exit() ans = 1 s =set() left = 0 while left < len(A): if A[left] not in s: s.add(A[left]) right = left while right < len(A) and A[right] == A[left]: right += 1 left = right else: print(-1) exit()