結果

問題 No.2126 MEX Game
ユーザー rin204
提出日時 2022-11-18 21:32:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 81,792 KB
最終ジャッジ日時 2024-09-20 01:56:16
合計ジャッジ時間 2,574 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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