[Solution] Perfect Permutation Codeforces Solution
You are given a positive integer .
The weight of a permutation is the number of indices such that divides . Find a permutation with the minimum possible weight (among all permutations of length ).
A permutation is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array) and is also not a permutation ( but there is in the array).
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The only line of each test case contains a single integer () — the length of permutation.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, print a line containing integers so that the permutation has the minimum possible weight.
If there are several possible answers, you can print any of them.
No comments:
Post a Comment