302639: CF513B1. Permutations
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:2
Solved:0
Description
Permutations
题意翻译
给定一个由数字 $1,2, ...,n$ 构成的排列 $p$。 并且给定 $f(p)$ 的求和定义如下: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF513B1/01b3997850b3844bd3627bf7c28ebf2176a4c489.png) 在所有能使 $f(p)$ 取到最大值的排列中,输出按字典序的第$m$个排列。 ### 说明与提示 这个问题包含两个子问题。子问题对输入有不同的约束。您将获得正确解决子问题对应的分数。子问题的描述如下: 在子问题B1 (3 分),$1 ≤ n ≤ 8$。 在子问题B2 (4 分),$1 ≤ n ≤ 50$。题目描述
You are given a permutation $ p $ of numbers $ 1,2,...,n $ . Let's define $ f(p) $ as the following sum: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF513B1/01b3997850b3844bd3627bf7c28ebf2176a4c489.png)Find the lexicographically $ m $ -th permutation of length $ n $ in the set of permutations having the maximum possible value of $ f(p) $ .输入输出格式
输入格式
The single line of input contains two integers $ n $ and $ m $ ( $ 1<=m<=cnt_{n} $ ), where $ cnt_{n} $ is the number of permutations of length $ n $ with maximum possible value of $ f(p) $ . The problem consists of two subproblems. The subproblems have different constraints on the input. You will get some score for the correct submission of the subproblem. The description of the subproblems follows. - In subproblem B1 ( $ 3 $ points), the constraint $ 1<=n<=8 $ will hold. - In subproblem B2 ( $ 4 $ points), the constraint $ 1<=n<=50 $ will hold.
输出格式
Output $ n $ number forming the required permutation.
输入输出样例
输入样例 #1
2 2
输出样例 #1
2 1
输入样例 #2
3 2
输出样例 #2
1 3 2