I am trying to create a max-heap of pair that will compare the first part of the pair and if they are equal it will not swap element? But still its accessing the smaller element first due to which my algorithm is not working, am i doing something wrong?
Compare function
class Comp{
public:
bool operator()(pair<int,int> &a , pair<int,int> &b){
return a.first > b.first;
}
};
Usage
priority_queue<pair<int,int>,vector<pair<int,int>> , Comp> q;
Full code - https://pastecode.io/s/p4fw9ibw