시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
4 초 | 1024 MB | 24 | 12 | 12 | 54.545% |
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.
6 3 3 2 1 3 1 3
2 1 3
10 5 5 4 3 2 1 4 1 1 5 5
3 2 1 4 5
ICPC > Regionals > North America > North Central North America Regional > NCNA 2019 E번