Open Mahi1901 opened 1 year ago
Can you please assign this issue to me? I have the best possible solution for this problem, also I have explained every step of my code.
Mention college name, year and branch. @Sid21112002
Jalpaiguri Government Engineering College 2nd year, Information Technology Department
I have assigned, Happy coding!
Nikita Miraje Cummins college of engineering for women Dept: Electronics and telecommunication I would like to work on this issue. Can you please assign me this issue?
Given a positive integer n and an integer kk such that 0≤k≤n, find any permutation A of 1,2…n such that the number of indices for which Ai=i is exactly k. If there exists no such permutation, print −1. If there exist multiple such permutations, print any one of them.
Input Format First line of the input contains T, the number of test cases. Then the test cases follow. Each test case contains a single line of input, two integers n, k. Output Format For each test case, print a permutation in a single line, if a permutation with the given constraints exists. Print −1 otherwise.
Constraints 1≤T≤10^5 1≤n≤10^5 0≤k≤n Sum of n over all test cases doesn't exceed 2⋅10^6.
Sample 1: Input 3 2 1 3 1 4 2
Output -1 1 3 2 3 2 1 4