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. if (k==0)
  17. {
  18. cout<<-1<<endl;
  19. continue;
  20. }
  21. if (k<(n/2))
  22. {
  23. vector<int> b(a.begin(),a.begin()+n-k),c(a.begin()+n-k,a.end());
  24. for (int i=1;i<=k;i++)
  25. {
  26. b.insert(b.begin()+i,c[i-1]);
  27. }
  28. for(int i=0;i<n;i++)
  29. {
  30. cout<<b[i]<<' ';
  31. }
  32. cout<<endl;
  33. }
  34. else
  35. {
  36. cout<<-1<<endl;
  37. }
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0s 5568KB
stdin
5
1 0
5 2
6 6
2 1
6 1
stdout
-1
-1
-1
-1
1 6 2 3 4 5