[Solution] Build Permutation Codeforces Solution
A -indexed array of size is called good if for all valid indices (), is a perfect square.
Given an integer . Find a permutation of that is good or determine that no such permutation exists.
An integer is said to be a perfect square if there exists an integer such that .
An array is a permutation of an array if consists of the elements of in arbitrary order. For example, is a permutation
occupied
of while is not a permutation of .
The first line contains a single integer () — the number of test cases.
The only line of each test case contains a single integer () — the length of the permutation .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output distinct integers () — the permutation — if the answer exists, and otherwise.
No comments:
Post a Comment