题目描述
Problem Description
Let's keep the problem simple.
Given natural numbers \( n \), \( k \), and \( x \), you are required to find the \( k \)-th smallest permutation of \( 1 \sim n \) with exactly \( x \) inversions. The permutation is denoted as \( a_1, a_2, \ldots, a_n \). The existence of such a permutation is guaranteed.
Note: An inversion is a pair \( (i, j) \) such that \( i < j \) and \( a_i > a_j \). The comparison is lexicographical, meaning the comparison is based on the first differing position from the beginning. The \( k \)-th smallest permutation is numbered starting from 1. A permutation of \( 1 \sim n \) is defined as a sequence of length \( n \) that can be sorted to \( 1 \sim n \).
Input Format
A single line containing three natural numbers \( n \), \( k \), and \( x \).
Output Format
Output the required permutation, a single line with \( n \) numbers separated by spaces.
Sample Input and Output
Sample Input #1
3 2 2
Sample Output #1
3 1 2
Sample Input #2
10 6 4
Sample Output #2
1 2 3 4 5 7 6 10 9 8
Sample Input #3
50 233 233
Sample Output #3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 32 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 33 35 34 31 30 29 28
Sample Input #4
50 233333333 333
Sample Output #4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 43 49 50 47 46 45 48 44 41 42 40 39 37 38 36 35 34 33 32 30 29 31 28 25 26 27 24
Notes
For \( 10\% \) of the data, \( n \leq 8 \).
For \( 30\% \) of the data, \( n \leq 10 \).
For \( 50\% \) of the data, \( n \leq 50 \).
For another \( 20\% \) of the data, \( k = 1 \).
For \( 100\% \) of the data, \( 1 \leq n \leq 300 \), \( 1 \leq k \leq 10^{13} \), and a valid permutation is guaranteed to exist.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分