0%

优先队列

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
priority_queue<int,vector<int>,greater<int> >q;//小顶堆
priority_queue<int> q;//大顶堆,默认

struct node{
int c, fc;
bool operator < (const node& a) const {
return fc < a.fc;//大顶
}
}
priority_queue<node> q;

struct node2{//重写仿函数
bool oprator() (node a,node b) {
return a,x<b.x;//大顶
}
}
priority_queue<node,vector<node>,node2> q;