結果

問題 No.2126 MEX Game
ユーザー lilictakalilictaka
提出日時 2023-01-03 21:36:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 126,208 KB
最終ジャッジ日時 2024-05-05 07:37:35
合計ジャッジ時間 2,955 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,376 KB
testcase_01 AC 40 ms
53,632 KB
testcase_02 AC 38 ms
54,144 KB
testcase_03 AC 40 ms
53,504 KB
testcase_04 AC 40 ms
54,016 KB
testcase_05 AC 41 ms
53,376 KB
testcase_06 AC 40 ms
53,632 KB
testcase_07 WA -
testcase_08 AC 40 ms
53,760 KB
testcase_09 AC 41 ms
53,632 KB
testcase_10 AC 108 ms
107,136 KB
testcase_11 AC 109 ms
107,648 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 112 ms
100,224 KB
testcase_16 AC 112 ms
99,712 KB
testcase_17 AC 71 ms
84,992 KB
testcase_18 AC 70 ms
85,888 KB
testcase_19 AC 62 ms
81,024 KB
testcase_20 AC 63 ms
81,408 KB
testcase_21 AC 128 ms
126,208 KB
testcase_22 AC 40 ms
53,760 KB
testcase_23 AC 40 ms
53,632 KB
testcase_24 AC 40 ms
53,632 KB
testcase_25 AC 40 ms
53,760 KB
testcase_26 WA -
testcase_27 AC 41 ms
53,632 KB
testcase_28 AC 39 ms
53,632 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
cnt = defaultdict(int)
for a in A:
    cnt[a] +=1
one = []
two = []
other = 0
for key in cnt.keys():
    if cnt[key] == 1:
        one.append(key)
    elif cnt[key] == 2:
        two.append(key)
    else:
        other +=1
setA = set(A)
for i in range(N+1):
    if i in setA:
        pass
    else:
        ans = i
        break
one.sort()
two.sort()
if len(one) >= 1:
    co = -1
    if len(one) >=2:
        co = one[1]
    if len(two) >= 1 and two[-1] > one[0]:
        co = max(co,two[-1])
    if co == -1:
        ans = min(ans,one[0])
    else:
        ans = min(ans,co)

else:
    pass
print(ans)
0