結果

問題 No.2126 MEX Game
ユーザー gr1msl3y
提出日時 2022-11-26 11:19:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 83,072 KB
最終ジャッジ日時 2024-10-02 14:53:39
合計ジャッジ時間 2,670 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
A.sort()
indl = 0
indr = N
M = 10**5
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:
        if indl == indr:
            print(i)
            exit()
        else:
            indr -= 1
0