Logo
(追記) (追記ここまで)

27198번 - kex 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB89484261.765%

문제

Consider the set of non-negative integers $A$. The minimum non-negative integer that does not occur in this set is considered, for example, in game theory, and is denoted as $\mathrm{mex}(A)$. For example, $\mathrm{mex}(\{0, 1, 2, 4, 5, 9\})=3$.

Ann has decided to generalize the concept of mex. Consider a positive integer $k$ and a set of non-negative integer $A$. Denote as $\mathrm{kex}(A,k)$ a non-negative integer that is $k$-th in ascending order among all integers that are not in $A$. For example, $\mathrm{kex}(\{0, 1, 2, 4, 5, 9\}, 2)=6$.

You must find $\mathrm{kex}(A, k_i)$ for the given set of integers $A$ and $q$ values of $k_i$.

입력

The first line of input contains two integers $n$ and $q$ (1ドル \leq n, q \leq 10^5$) --- number of elements in $A$ and number of $\mathrm{kex}$ numbers, that you have to find.

In second line of input contains $n$ different not negative integers, each of which is at most 10ドル^9,ドル --- elements of $A$.

In third line of input contains $q$ integers $k_i$ (1ドル\leq k_i \leq 10^9$).

출력

Print values: $\mathrm{kex}(A, k_1), \mathrm{kex}(A, k_2),\ldots, \mathrm{kex}(A,k_q)$.

제한

예제 입력 1

4 10
1 2 6 7
1 2 3 4 5 6 7 8 10 11

예제 출력 1

0 3 4 5 8 9 10 11 13 14

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia Team High School Programming Contest > Russia Team High School Programming Contest 2022 E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /