【STL】priority_queue 的自定义排序

重载 operator< 或者自己写仿函数:

 1 typedef struct{
 2     string name;
 3     int rp;
 4 }node;
 5 
 6 bool operator <( node x, node y ){
 7     if(x.rp>y.rp) return 1;
 8     else if(x.rp==y.rp && x.name<y.name) return 1;
 9     return 0;
10 }
11 
12 priority_queue <node> q[MAXN];

 

posted @ 2015-04-19 11:54  纸牌  阅读(1299)  评论(0编辑  收藏  举报