結果
| 問題 |
No.2126 MEX Game
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2022-11-18 22:05:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 543 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 82,432 KB |
| 最終ジャッジ日時 | 2024-09-20 02:26:07 |
| 合計ジャッジ時間 | 2,656 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 5 |
ソースコード
def mex(S):
x=0
while x in S:
x+=1
return x
def solve():
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
A_max=max(A)
C=[0]*(max(A)+2)
for a in A:
C[a]+=1
for a in range(A_max+2):
if C[a]==0:
return a
elif C[a]==1:
for b in range(a+1,A_max+1):
if C[b]:
return a+1
else:
return a
#==================================================
print(solve())
Kazun