結果

問題 No.2126 MEX Game
ユーザー ntudantuda
提出日時 2022-11-19 12:41:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 11,864 KB
実行使用メモリ 21,588 KB
最終ジャッジ日時 2023-10-20 17:51:54
合計ジャッジ時間 2,686 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,076 KB
testcase_01 AC 27 ms
10,092 KB
testcase_02 AC 26 ms
10,076 KB
testcase_03 AC 27 ms
10,076 KB
testcase_04 AC 28 ms
10,692 KB
testcase_05 AC 27 ms
10,076 KB
testcase_06 AC 27 ms
10,076 KB
testcase_07 AC 26 ms
10,076 KB
testcase_08 AC 26 ms
10,076 KB
testcase_09 AC 27 ms
10,076 KB
testcase_10 AC 72 ms
21,588 KB
testcase_11 AC 81 ms
21,588 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 68 ms
21,572 KB
testcase_16 AC 67 ms
21,448 KB
testcase_17 AC 65 ms
20,892 KB
testcase_18 AC 64 ms
21,200 KB
testcase_19 AC 52 ms
11,872 KB
testcase_20 AC 56 ms
11,872 KB
testcase_21 WA -
testcase_22 AC 28 ms
10,076 KB
testcase_23 AC 28 ms
10,092 KB
testcase_24 AC 26 ms
10,076 KB
testcase_25 AC 27 ms
10,076 KB
testcase_26 AC 27 ms
10,076 KB
testcase_27 AC 26 ms
10,076 KB
testcase_28 AC 24 ms
10,076 KB
testcase_29 AC 25 ms
10,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
maxa = max(A)
X = [0] * (maxa + 1)
for a in A:
    X[a] += 1
cnt = 0
for i in range(maxa + 1):
    if X[i] == 0:
        i -= 1
        break
    elif X[i] == 1:
        if cnt == 0:
            cnt += 1
        else:
            break

if cnt == 0:
    print(i + 1)
else:
    if sum(X[:i + 1]) >= 2 * (i + 1):
        print(i + 1)
    elif N >= 2 * (i + 1):
        print(i + 1)
    else:
        print(i)
0