結果

問題 No.2126 MEX Game
ユーザー 遭難者
提出日時 2022-11-14 21:02:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 83,328 KB
最終ジャッジ日時 2024-09-19 01:44:25
合計ジャッジ時間 2,396 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
inf = 10 ** 5 + 1
c = [0] * inf
for i in list(map(int, input().split())):
    c[i] += 1
one, ok1, ok2 = 0, True, 0
for i in range(inf):
    if c[i] >= 1:
        ok2 = i
k = 0
while 1:
    ok1 &= c[k] <= 2
    if c[k] == 1:
        one += 1
    if c[k] == 0 or one > 1 or one == 1 and ok1 and k >= ok2:
        print(k)
        exit()
    k += 1
0