結果

問題 No.2126 MEX Game
ユーザー ShirotsumeShirotsume
提出日時 2022-11-18 22:35:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 100,692 KB
最終ジャッジ日時 2023-10-20 07:31:38
合計ジャッジ時間 3,815 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
75,356 KB
testcase_01 AC 57 ms
75,356 KB
testcase_02 AC 58 ms
75,352 KB
testcase_03 AC 57 ms
75,356 KB
testcase_04 AC 56 ms
75,356 KB
testcase_05 AC 57 ms
75,352 KB
testcase_06 AC 57 ms
75,356 KB
testcase_07 AC 58 ms
75,352 KB
testcase_08 AC 56 ms
75,356 KB
testcase_09 AC 56 ms
75,356 KB
testcase_10 AC 116 ms
97,648 KB
testcase_11 AC 101 ms
97,652 KB
testcase_12 AC 101 ms
97,652 KB
testcase_13 AC 99 ms
97,656 KB
testcase_14 WA -
testcase_15 AC 100 ms
99,724 KB
testcase_16 AC 100 ms
99,660 KB
testcase_17 AC 88 ms
89,420 KB
testcase_18 AC 86 ms
89,608 KB
testcase_19 AC 77 ms
88,520 KB
testcase_20 AC 78 ms
88,520 KB
testcase_21 AC 87 ms
100,692 KB
testcase_22 AC 58 ms
75,360 KB
testcase_23 AC 59 ms
75,360 KB
testcase_24 AC 60 ms
75,356 KB
testcase_25 AC 57 ms
75,356 KB
testcase_26 AC 57 ms
75,356 KB
testcase_27 AC 57 ms
75,356 KB
testcase_28 AC 58 ms
75,356 KB
testcase_29 AC 58 ms
75,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
sys.setrecursionlimit(5 * 10 ** 5)
from pypyjit import set_param
set_param('max_unroll_recursion=-1')
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n = ii()

A = Counter(li())
yoyu = False
for i in range(0, 10 ** 5 + 1):
    if A[i] >= 3:
        yoyu = True
ans = -1
for i in range(0, 10 ** 5 + 1):
        if A[i] == 1 and yoyu:
            A[i] = 2
            yoyu = False
        elif A[i] <= 1:
            ans = i
            break

A[max(A)] -= 1
yoyu = True
for i in range(0, 10 ** 5 + 1):
        if A[i] == 1 and yoyu:
            A[i] = 2
            yoyu = False
        elif A[i] <= 1:
            ans = max(ans, i)
            break

print(ans)
0