使用了结构体的进阶模板后,我们的使用将会更加方便。
struct Node {
int x,y,step;
Node(int x = 0,int y = 0,int step = 0):x(x),y(y),step(step){}
};
struct Node {
int to,cost;
Node (int x = 0,int c = 0):to(x),cost(c){}
bool operator < (const Node &a) const {
return a.cost < cost;
}
};
堆的使用