P23649 [AtCoder] Array of Fortune
普及+
题目描述

Problem Description

A sequence $ A $ = {$A_1,\ A_2,\ A_3,\ ...,\ A_N$} of length $ N $ is called a "Array of Fortune" if it satisfies the following conditions:

  • Each integer from $ 1 $ to $ N $ appears exactly once in $ A $.
  • There are exactly $ R $ pairs of $(i,\ j)$ ($ i < j $) such that $a_i \geq a_j + K$.

The sequence master tried to find an Array of Fortune but couldn't find one quickly. Please construct one for him. If no Array of Fortune exists, output No Luck.

Input Format

The input is given from the standard input in the following format:

$ N $ $ K $ $ R $

Output Format

If no Array of Fortune exists, output No Luck.
If an Array of Fortune exists, output one possible Array of Fortune in the following format:

$ A_1 $ $ A_2 $ $ A_3 $ $ ... $ $ A_N $

If multiple Arrays of Fortune exist, any one of them will be considered correct.

Sample Input and Output

Sample Input #1

5 2 4

Sample Output #1

3 4 1 5 2

Sample Input #2

7 1 21

Sample Output #2

7 6 5 4 3 2 1

Sample Input #3

10 3 22

Sample Output #3

6 7 8 9 10 1 2 3 4 5

Sample Input #4

10 5 45

Sample Output #4

No Luck

Notes/Hints

Constraints

  • $1 \leq N \leq 100,000$
  • $1 \leq K \leq N - 1$
  • $0 \leq R \leq N \times (N - 1) / 2$
  • All input values are integers.

Subtasks

This problem is divided into subtasks.

Subtask $ 1 $ [$ 200 $ points]

  • $N \leq 100$

Subtask $ 2 $ [$ 400 $ points]

  • No additional constraints.

Sample Explanation 1

For the sequence $ A = {3, 4, 1, 5, 2} $, there are exactly $ 4 $ pairs $ (i, j) $ ($ i < j $) that satisfy $a_i \geq a_j + 2$. These pairs are: - $ (i, j) = (1, 3), (2, 3), (2, 5), (4, 5) $. Therefore, the sequence $ A $ is one of the Arrays of Fortune. Other outputs, such as the following, would also be correct:

5 1 3 4 2
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 2 4
样例输出
3 4 1 5 2