E Fixed Point Permutations
题号:NC224729
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

A permutation of size 𝒏 is a list of integers (𝑝1, 𝑝2, … , 𝑝n) from 1 to 𝒏 such that each number appears exactly once.

The number of fixed points of a permutation is the number of indices 𝒊 such that 𝑝𝒊 = 𝒊.

Given three numbers 𝒏, 𝒎, and 𝒌, find the 𝒌th lexicographically smallest permutation of size 𝒏 that has exactly
𝒎 fixed points (or print -1 if there are fewer than 𝒌 permutations that satisfy the condition).

输入描述:

The single line of input contains three space-separated integers 𝒏 (1 ≤ 𝒏 ≤ 50)  𝒎 (0 ≤ 𝒎 ≤ 𝒏)  𝒌 (1 ≤ 𝒌 ≤ 1018)
where 𝒏 is the size of the permutations, 𝒎 is the number of desired fixed points, and the output should
be the  𝒌th  lexicographically smallest permutation of the numbers 1 to 𝒏 that has exactly 𝒎 fixed points.

输出描述:

Output the desired permutation on a single line as a sequence of 𝒏 space-separated integers, or output -1 if no such permutation exists.
示例1

输入

复制
3 1 1

输出

复制
1 3 2
示例2

输入

复制
3 2 1

输出

复制
-1
示例3

输入

复制
5 3 7

输出

复制
2 1 3 4 5