-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question 70 #153
Comments
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. |
Jalpaiguri Government Engineering College |
I have assigned, Happy coding! |
Nikita Miraje |
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
The text was updated successfully, but these errors were encountered: