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

21186번 - Early Orders 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB53282857.143%

문제

You are given a list of integers $x_1, x_2, \ldots, x_n$ and a number $k$. It is guaranteed that each $i$ from 1ドル$ to $k$ appears in the list at least once.

Find the lexicographically smallest subsequence of $x$ that contains each integer from 1ドル$ to $k$ exactly once.

입력

The first line will contain two integers $n$ and $k,ドル with 1ドル\le k\le n\le 200,000円$. The following $n$ lines will each contain an integer $x_i$ with 1ドル\le x_i\le k$.

출력

Write out on one line, separated by spaces, the lexicographically smallest subsequence of $x$ that has each integer from 1ドル$ to $k$ exactly once.

제한

예제 입력 1

6 3
3
2
1
3
1
3

예제 출력 1

2 1 3

예제 입력 2

10 5
5
4
3
2
1
4
1
1
5
5

예제 출력 2

3 2 1 4 5

힌트

출처

ICPC > Regionals > North America > North Central North America Regional > NCNA 2019 E번

  • 문제를 만든 사람: Lewin Gan
(追記) (追記ここまで)

출처

대학교 대회

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

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