Codeforces Round 309 (Div. 1)
B
Kyoya and Permutation
Codeforces
1900
原题
← AC →
翻译中…

Let's define the permutation of length $*n*$ as an array $*p* = [*p*_{1}, *p*_{2}, ..., *p*_{*n*}]$ consisting of $*n*$ distinct integers from range from $1$ to $*n*$. We say that this permutation maps value $1$ into the value $*p*_{1}$, value $2$ into the value $*p*_{2}$ and so on.

翻译中…

Kyota Ootori has just learned about cyclic representation of a permutation. A cycle is a sequence of numbers such that each element of this sequence is being mapped into the next element of this sequence (and the last element of the cycle is being mapped into the first element of the cycle). The cyclic representation is a representation of $*p*$ as a collection of cycles forming $*p*$. For example, permutation $*p* = [4, 1, 6, 2, 5, 3]$ has a cyclic representation that looks like $(142)(36)(5)$ because 1 is replaced by 4, 4 is replaced by 2, 2 is replaced by 1, 3 and 6 are swapped, and 5 remains in place.

翻译中…

Permutation may have several cyclic representations, so Kyoya defines the standard cyclic representation of a permutation as follows. First, reorder the elements within each cycle so the largest element is first. Then, reorder all of the cycles so they are sorted by their first element. For our example above, the standard cyclic representation of $[4, 1, 6, 2, 5, 3]$ is $(421)(5)(63)$.

翻译中…

Now, Kyoya notices that if we drop the parenthesis in the standard cyclic representation, we get another permutation! For instance, $[4, 1, 6, 2, 5, 3]$ will become $[4, 2, 1, 5, 6, 3]$.

翻译中…

Kyoya notices that some permutations don't change after applying operation described above at all. He wrote all permutations of length $*n*$ that do not change in a list in lexicographic order. Unfortunately, his friend Tamaki Suoh lost this list. Kyoya wishes to reproduce the list and he needs your help. Given the integers $*n*$ and $*k*$, print the permutation that was $*k*$-th on Kyoya's list.

翻译中…

Input

翻译中…

The first line will contain two integers $*n*$, $*k*$ ($1 ≤ *n* ≤ 50$, $1 ≤ *k* ≤ *min*{10^{18}, *l*}$ where $*l*$ is the length of the Kyoya's list).

翻译中…

Output

翻译中…

Print $*n*$ space-separated integers, representing the permutation that is the answer for the question.

翻译中…

Note

翻译中…

The standard cycle representation is $(1)(32)(4)$, which after removing parenthesis gives us the original permutation. The first permutation on the list would be $[1, 2, 3, 4]$, while the second permutation would be $[1, 2, 4, 3]$.

翻译中…

样例

Input #1
4 3
Output #1
1 3 2 4
InputCopy OutputCopy
Input #2
10 1
Output #2
1 2 3 4 5 6 7 8 9 10
InputCopy OutputCopy
题目信息
题号
553B
时间限制
2 s
内存限制
256 MB
标签
二分
组合数学
构造
贪心
模拟
数学

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