結果

問題 No.2126 MEX Game
ユーザー 👑 tamatotamato
提出日時 2022-11-18 21:44:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 81,768 KB
実行使用メモリ 97,680 KB
最終ジャッジ日時 2023-10-20 06:30:47
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
53,472 KB
testcase_01 AC 49 ms
53,472 KB
testcase_02 AC 50 ms
53,472 KB
testcase_03 AC 52 ms
53,472 KB
testcase_04 AC 52 ms
53,516 KB
testcase_05 AC 49 ms
53,472 KB
testcase_06 AC 44 ms
53,472 KB
testcase_07 AC 44 ms
53,472 KB
testcase_08 AC 44 ms
53,472 KB
testcase_09 AC 50 ms
53,472 KB
testcase_10 AC 89 ms
92,448 KB
testcase_11 AC 87 ms
92,448 KB
testcase_12 AC 87 ms
92,448 KB
testcase_13 AC 86 ms
92,448 KB
testcase_14 AC 85 ms
94,292 KB
testcase_15 AC 84 ms
94,292 KB
testcase_16 AC 83 ms
94,252 KB
testcase_17 AC 74 ms
83,156 KB
testcase_18 AC 73 ms
83,108 KB
testcase_19 AC 66 ms
80,504 KB
testcase_20 AC 65 ms
80,504 KB
testcase_21 AC 83 ms
97,680 KB
testcase_22 AC 45 ms
53,472 KB
testcase_23 AC 44 ms
53,472 KB
testcase_24 AC 47 ms
53,472 KB
testcase_25 AC 45 ms
53,472 KB
testcase_26 AC 44 ms
53,472 KB
testcase_27 AC 43 ms
53,472 KB
testcase_28 AC 44 ms
53,472 KB
testcase_29 AC 44 ms
53,472 KB
権限があれば一括ダウンロードができます

ソースコード

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