fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. void solve(){
  4. int n;
  5. cin>>n;
  6. vector<vector<pair<int,int>>> v(3,vector<pair<int,int>>(n));
  7. for(int i=0;i<3;i++){
  8. for(int j=0;j<n;j++){
  9. int k;
  10. cin>>k;
  11. pair<int,int> p={k,j+1};
  12. v[i][j]=p;
  13. }
  14. }
  15.  
  16. for(int i=0;i<3;i++){
  17. sort(v[i].begin(),v[i].end(),greater<pair<int,int>>());
  18. }
  19. for(int i=0;i<3;i++){
  20. for(int j=0;j<n;j++){
  21. cout<<v[i][j].first<<v[i][j].second<<" ";
  22. }
  23. cout<<endl;
  24. }
  25.  
  26.  
  27. }
  28. int main() {
  29. // your code goes here
  30. int t;
  31. cin>>t;
  32. while(t--)solve();
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5284KB
stdin
1
10
17 5 4 18 12 4 11 2 16 16
8 4 14 19 3 12 6 7 5 16
3 4 8 11 10 8 10 2 20 3
stdout
184 171 1610 169 125 117 52 46 43 28 
194 1610 143 126 81 78 67 59 42 35 
209 114 107 105 86 83 42 310 31 28