結果

問題 No.2126 MEX Game
ユーザー lam6er
提出日時 2025-03-20 20:23:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,708 KB
実行使用メモリ 100,380 KB
最終ジャッジ日時 2025-03-20 20:25:59
合計ジャッジ時間 3,047 ms
ジャッジサーバーID
(参考情報)
judge4 / 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