[Solution] Permutation Value Codeforces Solution
You are given an integer . You have to construct a permutation of size .
A permutation is an array where each integer from to (where is the size of permutation) occurs exactly once. For example, is a permutation of size ; is a permutation of size ; is not a permutation (the integer is absent), is not a permutation (the integer appears twice).
A subsegment of a permutation is a contiguous subsequence of that permutation. For example, the permutation has subsegments: , , , , , , , , and .
The value of the permutation is the number of its subsegments which are also permutations. For example, the value of is since the subsegments , and are permutations.
You have to construct a permutation of size with minimum possible value among all permutations of size .
The first line contains one integer () — the number of test cases.
Then, lines follow. The -th of them contains one integer () representing the -th test case.
For each test case, print integers — the permutation of size with minimum possible value. If there are
multiple such permutations, print any of them.
In the first example, the permutation is one of the possible answers; its value is .
In the second example, the permutation is one of the possible answers; its value is .
No comments:
Post a Comment