結果

問題 No.2126 MEX Game
ユーザー lam6er
提出日時 2025-03-20 18:58:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 101,452 KB
最終ジャッジ日時 2025-03-20 18:59:32
合計ジャッジ時間 3,081 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
from collections import defaultdict

count = defaultdict(int)
for a in A:
    count[a] += 1

mex = 0
while True:
    if count[mex] == 0:
        break
    mex += 1

ans = mex
for x in range(mex):
    if count[x] == 1:
        ans = x
        break

print(ans)
0