다익스트라 알고리즘 구현할때


priority_queue를 쓰는데


이게 기본적으로 max heap이라


min heap으로 사용하려면 저장하는 값에 음수 기호를 붙여서 넣어야하잖아


근데 난 그게 싫어서


struct cmp {

bool operator() (pair<int, int>& a, pair<int, int>& b) {

return a.second < b.second;

}

};


이거 만든다음에


priority_queue<pair<int, int>, vector<pair<int,int>>, cmp> pq;


이런식으로 했거든


그러니까 시간이 겁나 초과되더라


이유가 뭔지 혹시 설명해줄 고수님 있으십니까