fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. vector<pair<int, int> > a;
  8. cin >> n;
  9. for(int i = 0; i < n; ++i)
  10. {
  11. int x, y;
  12. cin >> x >> y;
  13. a.push_back(make_pair(x, y));
  14. }
  15. sort(a.begin(), a.end());
  16. for(int i = 0; i < n; ++i)
  17. {
  18. cout << a[i].first << " " << a[i].second << endl;
  19. }
  20. }
Success #stdin #stdout 0s 3468KB
stdin
6
5 4 
6 9
4 5
8 1
7 0
3 2
stdout
3 2
4 5
5 4
6 9
7 0
8 1