結果

問題 No.2126 MEX Game
ユーザー tamato
提出日時 2022-11-18 21:44:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 99,300 KB
最終ジャッジ日時 2024-09-20 02:07:16
合計ジャッジ時間 2,801 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    from collections import Counter
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))

    C = Counter(A)
    flg = 1
    ans = 0
    for a in range(10 ** 5 + 10):
        if C[a] == 0:
            break
        elif C[a] == 1:
            if flg and (a + 1) * 2 <= N:
                flg = 0
                ans += 1
            else:
                break
        else:
            ans += 1
    print(min(ans, N // 2))


if __name__ == '__main__':
    main()
0