#abc253g. G - Swap Many Times
G - Swap Many Times
Score : points
问题描述
对于一个大于等于2的整数 ,存在 对整数对 满足条件 。
考虑按字典序递增顺序排列的这些整数对序列。令 分别为其第 项、第 项、……以及第 项。
在序列 上,我们将按照以下顺序对 执行以下操作:
- 将 和 交换位置。
求出所有操作执行完毕后的最终序列 。
我们说,在字典序中,如果满足以下任一条件,则 比 更小:
- 且
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
For an integer greater than or equal to , there are pairs of integers such that .
Consider the sequence of these pairs sorted in the increasing lexicographical order. Let be its -th, -th, , and -th elements, respectively. On a sequence , We will perform the following operation for in this order:
- Swap and .
Find the final after all the operations.
We say that is smaller than in the lexicographical order if and only if one of the following holds:
- and
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the terms of after all the operations in one line, separated by spaces.
Sample Input 1
5 3 6
Sample Output 1
5 1 2 3 4
Consider the sequence of pairs of integers such that sorted in the increasing lexicographical order. Its -rd, -th, -th, and -th elements are , respectively.
Corresponding to these pairs, transitions as follows.
$(1, 2, 3, 4, 5) \rightarrow (4, 2, 3, 1, 5) \rightarrow (5, 2, 3, 1, 4) \rightarrow (5, 3, 2, 1, 4) \rightarrow (5, 1, 2, 3, 4)$
Sample Input 2
10 12 36
Sample Output 2
1 10 9 8 7 4 3 2 5 6
update @ 2024/3/10 10:48:26