fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int t;
  8. cin>>t;
  9. while(t--)
  10. {
  11. int n,k;
  12. vector<int> a;
  13. cin>>n>>k;
  14. for (int i=1;i<=n;i++)
  15. a.push_back(i);
  16.  
  17. if (k<(n/2))
  18. {
  19. vector<int> b(a.begin(),a.begin()+n-k),c(a.begin()+n-k,a.end());
  20. for (int i=1;i<=k;i++)
  21. {
  22. b.insert(b.begin()+i,c[i-1]);
  23. }
  24. for(int i=0;i<n;i++)
  25. {
  26. cout<<b[i]<<' ';
  27. }
  28. cout<<endl;
  29. }
  30. else
  31. {
  32. cout<<-1<<endl;
  33. }
  34. }
  35. return 0;
  36. }
Success #stdin #stdout 0s 5688KB
stdin
5
1 0
5 2
6 6
2 1
6 1
stdout
-1
-1
-1
-1
1 6 2 3 4 5