AtCoder Regular Contest 133
A
Erase by Value
AtCoder
⌀ 235
原题
←B →
翻译中…

Problem Statement

翻译中…

Given is a sequence of $N$ integers $A=(A_1,A_2,\cdots,A_N)$.

翻译中…

Snuke now chooses a value in $A$. Let $x$ be the value chosen. Then, he makes an integer sequence $a$ by lining up all elements of $A$ that are not $x$ without changing the order.

翻译中…

Find the lexicographically smallest sequence that can be obtained as $a$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 200000$
  • $1 \leq A_i \leq N$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \cdots A_N

翻译中…

Output

翻译中…

Print the elements of the lexicographically smallest $a$, separated by spaces.

翻译中…

样例

Input #1
5
2 4 4 1 2
Output #1
2 1 2
For example, when $x=2$, we will have $a=(4,4,1)$. When $x=4$, we will have $a=(2,1,2)$, which is the lexicographically smallest.
Input #2
3
1 1 1
Output #2

When $x=1$, $a$ will be empty, which is obviously the lexicographically smallest. As a side note, the output may contain additional spaces or newlines.
Input #3
5
1 1 2 3 3
Output #3
1 1 2
题目信息
题号
arc133_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。