AtCoder Regular Contest 204 (Div. 1)
D
Favorite Interval
AtCoder
⌀ 3290
原题
← C→
翻译中…

Problem Statement

翻译中…

You are given integers $N, L, R$.

翻译中…

These integers satisfy the following:

翻译中…
  • $2 \leq N$
  • $0\leq L < R \leq N$
  • $(L, R)\neq (0, N)$
翻译中…

Initialize a length-$N$ sequence $A = (A_{0}, A_{1}, \dots , A_{N - 1})$ as $A = (0, 1, \dots, N - 1)$.

翻译中…

Choose a permutation $P = (P_{0}, P_{1}, \dots, P_{N - (R - L) - 1})$ of $(R - L, R - L + 1, \dots , N - 1)$, and perform the following operation for $i = 0, 1, \dots N - (R - L) - 1$ in this order.

翻译中…
  • Let $a$ be the remainder when $P_{i}$ is divided by $|A|$, and remove $A_{a}$ from $A$ (after removing an element, the indices of sequence $A$ are renumbered starting from $0$).
翻译中…

Determine whether there exists a $P$ such that $A = (L, L + 1, \dots , R - 1)$ in the end, and if it exists, output one such $P$.

翻译中…

Constraints

翻译中…
  • $2\leq N\leq 2\times 10^{5}$
  • $0\leq L < R\leq N$
  • $(L, R) \neq (0, N)$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N L R

翻译中…

Output

翻译中…

If there is no $P$ that makes $A = (L, L + 1, \dots , R - 1)$, output No.

翻译中…

If it exists, output a solution in the following format:

翻译中…

Yes
P_{0} P_{1} \cdots P_{N - (R - L) - 1}

翻译中…

Formally, output Yes on the first line, and output $P_{0}, P_{1}, \dots , P_{N - (R - L) - 1}$ separated by spaces on the second line.

翻译中…

If there are multiple solutions, any of them will be considered correct.

翻译中…

样例

Input #1
6 3 5
Output #1
Yes
2 4 5 3
When choosing $P = (2, 4, 5, 3)$, perform four operations on $A = (0, 1, 2, 3, 4, 5)$ as follows. - The remainder when $P_{0} = 2$ is divided by $|A| = 6$ is $2$, so remove $A_{2} = 2$ from $A$. Then, $A = (A_{0}, A_{1}, A_{2}, A_{3}, A_{4}) = (0, 1, 3, 4, 5)$. - The remainder when $P_{1} = 4$ is divided by $|A| = 5$ is $4$, so remove $A_{4} = 5$ from $A$. Then, $A = (A_{0}, A_{1}, A_{2}, A_{3}) = (0, 1, 3, 4)$. - The remainder when $P_{2} = 5$ is divided by $|A| = 4$ is $1$, so remove $A_{1} = 1$ from $A$. Then, $A = (A_{0}, A_{1}, A_{2}) = (0, 3, 4)$. - The remainder when $P_{3} = 3$ is divided by $|A| = 3$ is $0$, so remove $A_{0} = 0$ from $A$. Then, $A = (A_{0}, A_{1}) = (3, 4)$. Therefore, the goal can be achieved by setting $P = (2, 4, 5, 3)$. It is also acceptable to output $P = (5, 2, 4, 3)$.
Input #2
9 2 4
Output #2
Yes
4 5 6 7 3 8 2
Input #3
178 68 167
Output #3
No
题目信息
题号
arc204_d
时间限制
2 s
内存限制
1024 MB

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