Advertisement
istinishat

pair first ascending second descending

Nov 2nd, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. typedef struct Comp{
  2.     bool operator()(const pair<int,int>&a, const pair<int,int>&b){
  3.         if(a.f != b.f){
  4.             return a.f<b.f;
  5.         }
  6.         return a.s>b.s;
  7.     }
  8. };
  9.  
  10. pair<int,int>p[MAX];
  11.  
  12. Comp c;
  13. sort(p,p+(MAX-1),c);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement