Explaining doubt with example ::
I have a vector of pair say vv having values vv[0]=(9,1) vv[1]=(13,2) vv[2]=(9,3) vv[3]=(6,4) vv[4]=(9,5)
and an array 'aa' having values {5,10,1,4,3}
now using sort func., i want to sort my vector of pair such that if vv[i].first==vv[j].first then the one having larger value of aa[vv[i].second] and aa[vv[j].second] should come first otherwise normal sort.
so in this case for vector sorts to (6,4) (9,1) (9,5) (9,3) (13,2) because aa[1]>aa[5]>aa[3]
How should i modify inbuilt sort() to implement such behaviour.