結果

問題 No.2126 MEX Game
ユーザー rin204
提出日時 2022-11-18 21:29:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,568 KB
実行使用メモリ 83,556 KB
最終ジャッジ日時 2024-09-20 01:54:41
合計ジャッジ時間 2,799 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
A.sort()
cnt = [0] * (10 ** 5 + 1)
for a in A:
    cnt[a] += 1

tot = 0
for i in range(10 ** 5):
    tot += cnt[i]
    if cnt[i] == 0:
        print(i)
        break
    elif cnt[i] == 1:
        if tot == n:
            print(i)
        else:
            print(i + 1)
        break
0