結果

問題 No.2126 MEX Game
ユーザー 👑 H20H20
提出日時 2022-11-18 22:15:46
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,684 KB
実行使用メモリ 100,672 KB
最終ジャッジ日時 2023-10-20 07:05:13
合計ジャッジ時間 3,044 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,444 KB
testcase_01 AC 40 ms
53,444 KB
testcase_02 AC 38 ms
53,444 KB
testcase_03 AC 37 ms
53,444 KB
testcase_04 AC 39 ms
53,444 KB
testcase_05 AC 37 ms
53,444 KB
testcase_06 AC 38 ms
53,444 KB
testcase_07 AC 38 ms
53,444 KB
testcase_08 AC 39 ms
53,444 KB
testcase_09 AC 40 ms
53,444 KB
testcase_10 AC 89 ms
93,328 KB
testcase_11 AC 84 ms
93,348 KB
testcase_12 AC 84 ms
93,776 KB
testcase_13 AC 83 ms
93,780 KB
testcase_14 AC 83 ms
95,244 KB
testcase_15 AC 82 ms
95,244 KB
testcase_16 AC 83 ms
95,204 KB
testcase_17 AC 70 ms
85,824 KB
testcase_18 AC 69 ms
85,944 KB
testcase_19 AC 60 ms
80,624 KB
testcase_20 AC 60 ms
80,624 KB
testcase_21 AC 82 ms
100,672 KB
testcase_22 AC 40 ms
53,484 KB
testcase_23 AC 40 ms
53,484 KB
testcase_24 AC 38 ms
53,484 KB
testcase_25 AC 38 ms
53,484 KB
testcase_26 AC 38 ms
53,484 KB
testcase_27 AC 37 ms
53,484 KB
testcase_28 AC 38 ms
53,484 KB
testcase_29 AC 38 ms
53,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = int(input())
A = list(map(int, input().split())) 
CA = collections.Counter(A)
ans = 0
amari = False
for k,v in CA.items():
    if v>=3:
        amari=True
while CA[ans]>=2:
        ans+=1
if CA[ans] and ans*2+1<N:
    ans+=1
    if not amari:
        CA[max(A)]-=1
while CA[ans]>=2:
        ans+=1
print(ans)
0