結果
問題 |
No.3075 Mex Recurrence Formula
|
ユーザー |
![]() |
提出日時 | 2025-03-29 00:56:55 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 82,664 KB |
実行使用メモリ | 53,544 KB |
最終ジャッジ日時 | 2025-03-29 00:57:01 |
合計ジャッジ時間 | 4,904 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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(5*N): 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])