vector<pair<int,int> > v;
for(i=0;i<5;i++){
cin>>b>>c;
v.push_back(make_pair(b,c));
}
sort(v.begin(),v.end());
Is it possible to write a comparator for the sort function such that v[i].first
is sorted in increasing order and for similar values of v[i].first
, v[i].second
is sorted in decreasing order?
like:-
i/p:
13 10
44 15
13 15
13 99
6 45
o/p:
6 45
13 99
13 15
13 10
44 15