[Solution] Permutation Restoration Codeforces Solution
Monocarp had a permutation of integers , , ..., (a permutation is an array where each element from to occurs exactly once).
Then Monocarp calculated an array of integers of size , where . For example, if the permutation is , then the array is equal to .
Unfortunately, the Monocarp has lost his permutation, so he wants to restore it. Your task is to find a permutation that corresponds to the given array . If there are multiple possible permutations, then print
any of them. The tests are constructed in such a way that least one suitable permutation exists.
The first line contains a single integer () — number of test cases.
The first line of each test case contains a single integer ().
Grass Field Codeforces Solution
Permutation Codeforces Solution
Schedule Management Codeforces Solution
Permutation Restoration Codeforces Solution
Text Editor Codeforces Solution
The second line contains integers ().
Additional constrains on the input:
- the sum of over test cases does not exceed ;
- there exists at least one permutation that would yield this array .
For each test case, print integers — a permutation that corresponds to the given array . If there are multiple possible permutations, then print any of them.
No comments:
Post a Comment