fork(24) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define LL unsigned long long
  4. #define mp make_pair
  5. #define pb push_back
  6.  
  7. bool comparator(const pair<int,int> &A,const pair<int,int> &B)
  8. {
  9. if(A.second<=B.second)
  10. {
  11. if(A.first>=B.first)
  12. return 1;
  13. else return 0;
  14. }
  15. return 0;
  16. }
  17.  
  18. int main()
  19. {
  20. vector<pair<int,int> >V;
  21. V.pb(mp(1,2));
  22. V.pb(mp(1,3));
  23. V.pb(mp(2,4));
  24. V.pb(mp(2,1));
  25. V.pb(mp(2,2));
  26. sort(V.begin(),V.end(),&comparator);
  27. for(int i=0;i<V.size();i++)
  28. cout<<V[i].first<<" "<<V[i].second<<endl;
  29. return 0;
  30. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
2 1
2 2
1 2
1 3
2 4