結果

問題 No.2126 MEX Game
ユーザー ShirotsumeShirotsume
提出日時 2022-11-18 22:48:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 100,560 KB
最終ジャッジ日時 2023-10-20 07:46:50
合計ジャッジ時間 3,613 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
75,216 KB
testcase_01 AC 61 ms
75,216 KB
testcase_02 AC 60 ms
75,216 KB
testcase_03 AC 61 ms
75,208 KB
testcase_04 AC 61 ms
75,208 KB
testcase_05 AC 60 ms
75,212 KB
testcase_06 AC 62 ms
75,212 KB
testcase_07 AC 61 ms
75,208 KB
testcase_08 AC 60 ms
75,212 KB
testcase_09 AC 63 ms
75,208 KB
testcase_10 AC 105 ms
97,520 KB
testcase_11 AC 104 ms
97,524 KB
testcase_12 AC 106 ms
97,524 KB
testcase_13 AC 103 ms
97,524 KB
testcase_14 AC 105 ms
99,632 KB
testcase_15 AC 105 ms
99,596 KB
testcase_16 AC 105 ms
99,532 KB
testcase_17 AC 92 ms
89,292 KB
testcase_18 AC 91 ms
89,480 KB
testcase_19 AC 81 ms
88,368 KB
testcase_20 AC 80 ms
88,368 KB
testcase_21 AC 90 ms
100,560 KB
testcase_22 AC 61 ms
75,212 KB
testcase_23 AC 60 ms
75,208 KB
testcase_24 AC 61 ms
75,208 KB
testcase_25 AC 61 ms
75,212 KB
testcase_26 AC 61 ms
75,212 KB
testcase_27 AC 60 ms
75,208 KB
testcase_28 AC 62 ms
75,212 KB
testcase_29 AC 61 ms
75,208 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 + 2):
    if A[i] >= 3:
        yoyu = True
ans = -1
for i in range(0, 10 ** 5 + 2):
        if A[i] == 1 and yoyu:
            yoyu = False
        elif A[i] <= 1:
            ans = i
            break
k = max(A)
A[k] -= 1
yoyu = True
for i in range(0, 10 ** 5 + 2):
        if A[i] == 1 and yoyu:
            yoyu = False
        elif A[i] <= 1:
            ans = max(ans, i)
            break


print(ans)

0