結果
問題 | No.2126 MEX Game |
ユーザー |
![]() |
提出日時 | 2023-01-03 21:36:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 691 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 126,416 KB |
最終ジャッジ日時 | 2024-11-27 02:25:00 |
合計ジャッジ時間 | 3,423 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 6 |
ソースコード
from collections import defaultdictN = int(input())A = list(map(int,input().split()))cnt = defaultdict(int)for a in A:cnt[a] +=1one = []two = []other = 0for key in cnt.keys():if cnt[key] == 1:one.append(key)elif cnt[key] == 2:two.append(key)else:other +=1setA = set(A)for i in range(N+1):if i in setA:passelse:ans = ibreakone.sort()two.sort()if len(one) >= 1:co = -1if len(one) >=2:co = one[1]if len(two) >= 1 and two[-1] > one[0]:co = max(co,two[-1])if co == -1:ans = min(ans,one[0])else:ans = min(ans,co)else:passprint(ans)