結果
問題 | No.1053 ゲーミング棒 |
ユーザー |
|
提出日時 | 2022-04-06 23:12:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 82,440 KB |
実行使用メモリ | 106,252 KB |
最終ジャッジ日時 | 2024-11-27 20:57:57 |
合計ジャッジ時間 | 3,863 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
n = int(input()) A = list(map(int,input().split())) l = [] for a in A: if l and l[-1] == a: continue l.append(a) dic = {} for i in l: dic[i] = dic.get(i,0)+1 num = 0 for k,v in dic.items(): if v == 1: continue if v > 2: print(-1) exit() if l[0] == l[-1] == k: num += 1 else: print(-1) exit() print(num)