priorty_queue<자료형, Container ,비교 함수> 변수명.
struct cmp {
bool operator () (int n1, int n2)
{if ( n1> n2 )
return true;
else return false;
}
}
priority_queue<자료형, Container, cmp> 변수명
typedef struct _edges
{
int to;
int cost;
} Edges;
struct cmp
{
bool operator()(Edges e1, Edges e2)
{
if (e1.cost > e2.cost)
return true;
else
return false;
}
};
priority_queue<Edges, vector<Edges>, cmp> pq;