結果
問題 |
No.3075 Mex Recurrence Formula
|
ユーザー |
![]() |
提出日時 | 2025-03-29 00:58:59 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 82,344 KB |
実行使用メモリ | 116,268 KB |
最終ジャッジ日時 | 2025-03-29 00:59:04 |
合計ジャッジ時間 | 5,093 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 1 -- * 40 |
ソースコード
import sys input = sys.stdin.readline N,X=map(int,input().split()) A=list(map(int,input().split())) LIST=[0]*(N+3) for a in A: if a<N+3: LIST[a]+=1 for j in range(N+3): if LIST[j]==0: now=j break for i in range(N+1): A.append(now) LIST[now]+=1 if A[i]<N+3: LIST[A[i]]-=1 if LIST[A[i]]==0 and now>A[i]: now=A[i] while LIST[now]!=0: now+=1 if X-1<len(A): print(A[X-1]) else: k=X%(N+1) print(A[k+N])