[Solution] Woeful Permutation Codeforces Solution
Find any permutation of length such that the sum is as large as possible.
Here denotes the least common multiple (LCM) of integers and .
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 ().
Description of the test cases follows.
The only line for each test case contains a single integer ().
It is guaranteed that the sum of over all test cases does not exceed .
For each test case print integers , , , — the permutation with the maximum possible value of .
If there are multiple answers, print any of them.
No comments:
Post a Comment