結果

問題 No.2126 MEX Game
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-11-18 22:48:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 1,220 ms
コンパイル使用メモリ 81,392 KB
実行使用メモリ 101,768 KB
最終ジャッジ日時 2023-10-20 07:47:41
合計ジャッジ時間 4,393 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,360 KB
testcase_01 AC 41 ms
53,312 KB
testcase_02 AC 42 ms
55,360 KB
testcase_03 AC 42 ms
55,360 KB
testcase_04 AC 42 ms
53,312 KB
testcase_05 AC 41 ms
55,360 KB
testcase_06 AC 41 ms
53,312 KB
testcase_07 AC 42 ms
55,360 KB
testcase_08 AC 45 ms
55,360 KB
testcase_09 AC 41 ms
53,312 KB
testcase_10 AC 100 ms
94,176 KB
testcase_11 AC 101 ms
94,324 KB
testcase_12 AC 99 ms
94,672 KB
testcase_13 AC 98 ms
94,636 KB
testcase_14 AC 95 ms
96,036 KB
testcase_15 AC 78 ms
81,880 KB
testcase_16 AC 78 ms
81,816 KB
testcase_17 AC 87 ms
86,288 KB
testcase_18 AC 87 ms
86,424 KB
testcase_19 AC 63 ms
80,544 KB
testcase_20 AC 59 ms
78,160 KB
testcase_21 AC 98 ms
101,768 KB
testcase_22 AC 42 ms
55,388 KB
testcase_23 AC 42 ms
55,388 KB
testcase_24 AC 41 ms
55,388 KB
testcase_25 WA -
testcase_26 AC 42 ms
55,388 KB
testcase_27 AC 41 ms
55,388 KB
testcase_28 AC 42 ms
55,388 KB
testcase_29 AC 41 ms
55,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n = int(input())
A = list(map(int,input().split()))
A.sort()
if A[0] != 0:
    print(0)
    exit()

C = Counter(A)

s = sorted(C.keys())

more = 0
done = 0
last = -1
for x in s:
    if last+1 != x:
        print(last+1)
        exit()
    last = x
    if C[x] == 2:
        continue
    if C[x] > 2:
        more = 1
        continue

    if x != max(s) or more:
        if done:
            print(x)
            exit()
        else:
            done = 1
    else:
        print(x)
        exit()


print(last+1)
0