結果

問題 No.2126 MEX Game
ユーザー 👑 KazunKazun
提出日時 2022-11-18 22:30:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 84,356 KB
最終ジャッジ日時 2023-10-20 07:25:21
合計ジャッジ時間 3,049 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,452 KB
testcase_01 AC 44 ms
59,084 KB
testcase_02 AC 42 ms
53,452 KB
testcase_03 AC 41 ms
53,452 KB
testcase_04 AC 45 ms
59,872 KB
testcase_05 AC 40 ms
53,452 KB
testcase_06 AC 41 ms
53,452 KB
testcase_07 AC 41 ms
53,452 KB
testcase_08 AC 41 ms
53,452 KB
testcase_09 AC 41 ms
53,452 KB
testcase_10 AC 70 ms
84,328 KB
testcase_11 AC 73 ms
84,336 KB
testcase_12 AC 69 ms
84,356 KB
testcase_13 AC 70 ms
84,356 KB
testcase_14 AC 65 ms
82,552 KB
testcase_15 AC 68 ms
82,552 KB
testcase_16 AC 64 ms
82,500 KB
testcase_17 AC 66 ms
81,860 KB
testcase_18 AC 66 ms
81,984 KB
testcase_19 AC 61 ms
81,088 KB
testcase_20 AC 61 ms
81,088 KB
testcase_21 AC 66 ms
82,556 KB
testcase_22 AC 41 ms
53,452 KB
testcase_23 AC 41 ms
53,452 KB
testcase_24 AC 41 ms
53,484 KB
testcase_25 AC 41 ms
53,452 KB
testcase_26 AC 41 ms
53,452 KB
testcase_27 AC 42 ms
53,452 KB
testcase_28 AC 42 ms
53,452 KB
testcase_29 AC 41 ms
53,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#==================================================
def solve():
    from collections import Counter

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

    A_max=max(A)
    C=[0]*(max(A)+2)
    for a in A:
        C[a]+=1

    for a in range(A_max+2):
        if C[a]>=3:
            alpha=a
            break
    else:
        alpha=A_max

    C[alpha]-=1

    beta=0
    while C[beta]>=2:
        beta+=1

    C[beta]+=1

    mex=0
    while C[mex]>=2:
        mex+=1
    return mex

#==================================================
print(solve())
0