結果
問題 |
No.3075 Mex Recurrence Formula
|
ユーザー |
![]() |
提出日時 | 2025-03-29 01:05:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 274 ms / 2,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 450 ms |
コンパイル使用メモリ | 82,092 KB |
実行使用メモリ | 122,280 KB |
最終ジャッジ日時 | 2025-03-29 01:05:24 |
合計ジャッジ時間 | 9,661 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
import sys input = sys.stdin.readline from heapq import heappush,heappop 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 H=[] for j in range(N+3): if LIST[j]==0: H.append(j) H.sort() for i in range(N+1): now=heappop(H) A.append(now) LIST[now]+=1 if A[i]<N+3: LIST[A[i]]-=1 if LIST[A[i]]==0: heappush(H,A[i]) if X-1<len(A): print(A[X-1]) else: k=X%(N+1) print(A[k+N])