AtCoder Regular Contest 125
翻译中…
Problem Statement
翻译中…
Given are an integer $N$ and a monotonically increasing sequence of $K$ integers $A=(A_1,A_2,\cdots,A_K)$. Find the lexicographically smallest permutation $P$ of $(1,2,\cdots,N)$ that satisfies the following condition.
翻译中…
$A$is a longest increasing subsequence of$P$(a monotonically increasing subsequence of$P$with the maximum possible length). It is fine if$P$has multiple longest increasing subsequences, one of which is$A$.
翻译中…
From the Constraints of this problem, we can prove that there always exists a $P$ that satisfies the condition.
翻译中…
Constraints
翻译中…
$1 \leq K \leq N \leq 2 \times 10^5$$1 \leq A_1 < A_2 < \cdots < A_K \leq N$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K
A_1 A_2 \cdots A_K
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
3 2
2 3
Output #1
2 1 3
$A$ is a longest increasing subsequence of $P$ when $P=(2,1,3),(2,3,1)$. The answer is the lexicographically smallest of the two, or $(2,1,3)$.
Input #2
5 1
4
Output #2
5 4 3 2 1
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。