結果

問題 No.2126 MEX Game
ユーザー tamato
提出日時 2022-11-18 21:42:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 98,516 KB
最終ジャッジ日時 2024-09-20 02:05:34
合計ジャッジ時間 2,804 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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))


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