結果

問題 No.2126 MEX Game
ユーザー gr1msl3ygr1msl3y
提出日時 2022-11-26 12:16:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 83,864 KB
最終ジャッジ日時 2024-04-10 13:31:36
合計ジャッジ時間 2,998 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,616 KB
testcase_01 AC 36 ms
53,020 KB
testcase_02 AC 37 ms
53,596 KB
testcase_03 AC 37 ms
52,908 KB
testcase_04 AC 37 ms
52,140 KB
testcase_05 AC 37 ms
53,016 KB
testcase_06 AC 37 ms
52,572 KB
testcase_07 AC 37 ms
52,820 KB
testcase_08 AC 37 ms
52,572 KB
testcase_09 AC 36 ms
53,036 KB
testcase_10 AC 79 ms
81,836 KB
testcase_11 AC 78 ms
81,860 KB
testcase_12 AC 82 ms
83,428 KB
testcase_13 AC 82 ms
83,864 KB
testcase_14 AC 74 ms
80,236 KB
testcase_15 AC 74 ms
81,040 KB
testcase_16 AC 72 ms
81,968 KB
testcase_17 AC 75 ms
80,564 KB
testcase_18 AC 75 ms
81,848 KB
testcase_19 AC 57 ms
78,032 KB
testcase_20 AC 54 ms
78,132 KB
testcase_21 AC 74 ms
80,812 KB
testcase_22 AC 38 ms
52,200 KB
testcase_23 AC 37 ms
52,464 KB
testcase_24 AC 38 ms
53,664 KB
testcase_25 AC 37 ms
52,520 KB
testcase_26 AC 37 ms
53,408 KB
testcase_27 AC 37 ms
53,896 KB
testcase_28 AC 37 ms
52,280 KB
testcase_29 AC 38 ms
52,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
A.sort()
indl = 0
indr = N
res = 0
M = 10**5
ct1 = 0
for i in range(M):
    ct = 0
    while indl < indr and A[indl] == i:
        ct += 1
        indl += 1
    if ct == 0:
        print(i)
        exit()
    if ct == 1:
        ct1 += 1
        if ct1 == 2:
            print(i)
            exit()
        if res:
            res -= 1
        elif indl == indr:
            print(i)
            exit()
        else:
            indr -= 1
        indr -= 1
    else:
        res += ct-2
0