fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. vector< pair<int,int> > v;
  9. v.push_back(make_pair(3,2));
  10. v.push_back(make_pair(2,5));
  11. v.push_back(make_pair(1,4));
  12. v.push_back(make_pair(1,2));
  13. sort(v.begin(),v.end());
  14.  
  15. for(int i = 0;i < v.size();i++)
  16. cout<<v[i].first<<" "<<v[i].second<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
1 2
1 4
2 5
3 2