結果

問題 No.2126 MEX Game
ユーザー roaris
提出日時 2022-12-03 20:40:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,660 KB
実行使用メモリ 99,668 KB
最終ジャッジ日時 2024-10-11 00:15:33
合計ジャッジ時間 3,366 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
flag = False

for i in range(10**5+10):
    if cnt[i]>=2:
        if cnt[i]>=3:
            flag = True
    elif cnt[i]==1:
        if not flag:
            print(i)
            break
        else:
            print(i+1)
            break
    else:
        print(i)
        break
0