fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int tc, k, num, d, pstn;
  7. vector<int>arr;
  8. cin>>tc;
  9. while(tc--)
  10. {
  11. cin>>num;
  12.  
  13. for(int i=0; i<num; i++)
  14. {
  15. cin>>k;
  16. arr.push_back(k);
  17. }
  18.  
  19. cin>>d;
  20.  
  21. // it = lower_bound(arr.begin(), arr.end(), d);
  22.  
  23. // pstn = it + 1 - arr.begin();
  24.  
  25. for(int i=d; i<num; i++)
  26. {
  27. cout<<arr[i]<<" ";
  28. }
  29.  
  30. for(int i=0; i<d; i++)
  31. {
  32. cout<<arr[i]<<" ";
  33. }
  34.  
  35. cout<<endl;
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0s 3472KB
stdin
1
74
665 142 712 254 869 548 645 663 758 38 860 724 742 530 779 317 36 191 843 289 107 41 943 265 649 447 806 891 730 371 351 7 102 394 549 630 624 85 955 757 841 967 377 932 309 945 440 627 324 538 539 119 83 930 542 834 116 640 659 705 931 978 307 674 387 22 746 925 73 271 830 778 574 98 
11
stdout
724 742 530 779 317 36 191 843 289 107 41 943 265 649 447 806 891 730 371 351 7 102 394 549 630 624 85 955 757 841 967 377 932 309 945 440 627 324 538 539 119 83 930 542 834 116 640 659 705 931 978 307 674 387 22 746 925 73 271 830 778 574 98 665 142 712 254 869 548 645 663 758 38 860