結果

問題 No.2126 MEX Game
ユーザー lloyzlloyz
提出日時 2022-11-18 22:58:37
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 24,904 KB
最終ジャッジ日時 2023-10-20 07:57:20
合計ジャッジ時間 3,140 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
10,104 KB
testcase_01 AC 29 ms
10,104 KB
testcase_02 AC 28 ms
10,104 KB
testcase_03 AC 79 ms
10,104 KB
testcase_04 AC 28 ms
10,104 KB
testcase_05 AC 27 ms
10,104 KB
testcase_06 AC 28 ms
10,104 KB
testcase_07 AC 82 ms
10,104 KB
testcase_08 AC 29 ms
10,104 KB
testcase_09 AC 29 ms
10,104 KB
testcase_10 AC 90 ms
21,592 KB
testcase_11 AC 119 ms
21,592 KB
testcase_12 AC 99 ms
21,592 KB
testcase_13 AC 88 ms
21,592 KB
testcase_14 AC 77 ms
21,604 KB
testcase_15 AC 75 ms
21,604 KB
testcase_16 AC 72 ms
21,472 KB
testcase_17 AC 67 ms
20,924 KB
testcase_18 AC 69 ms
21,232 KB
testcase_19 AC 52 ms
11,900 KB
testcase_20 AC 52 ms
11,900 KB
testcase_21 AC 70 ms
24,904 KB
testcase_22 AC 82 ms
10,104 KB
testcase_23 AC 29 ms
10,104 KB
testcase_24 AC 28 ms
10,104 KB
testcase_25 AC 82 ms
10,104 KB
testcase_26 AC 84 ms
10,104 KB
testcase_27 AC 29 ms
10,104 KB
testcase_28 AC 29 ms
10,104 KB
testcase_29 AC 83 ms
10,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)

add = 0
for i in range(10**5 + 1):
    if counter[i] >= 2:
        if counter[i] >= 3:
            add = 1
        continue
    if counter[i] == 1:
        for j in range(i + 1, 10**5 + 1):
            if counter[j] >= 2:
                if j == i + 1:
                    add = 2
                    continue
                elif j > i + 1 and add == j - i:
                    add += 1
                    continue
            if counter[j] >= 1:
                if add == 0:
                    add = 1
                break
            if j == 10**5:
                if add > 1:
                    add -= 1
                break
        print(i + add)
        break
    print(i)
    break
0