fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7.  
  8. int n;
  9. cin>> n;
  10.  
  11. vector<int> ml(n,0), fl(n,0);
  12.  
  13. for(int i=0; i<n; i++){
  14. cin>>ml[i];
  15. }
  16. for(int i=0; i<n; i++){
  17. cin>>fl[i];
  18. }
  19.  
  20. sort(ml.begin(), ml.end(), greater<int>());
  21. sort(fl.begin(), fl.end());
  22.  
  23. int ptrm=0,ptrf=0;
  24.  
  25. for(int i=0; i<n; i++){
  26. cout<<ml[i]<<" "<<fl[i]<<endl;
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 5320KB
stdin
7
-1900 -2000 -2500 1500 1600 2500 -2500
1800 -1550 2200 -1550 2100 -2500 -1700
stdout
2500 -2500
1600 -1700
1500 -1550
-1900 -1550
-2000 1800
-2500 2100
-2500 2200