优先队列

View Code
//头文件:#include <queue>
struct Tpoint{
    int val,dead;
    //Tpoint(int v,int d):val(v),dead(d) {}
    bool friend operator<(Tpoint x,Tpoint y) {
        if(x.val!=y.val) return x.val>y.val;
        else return x.dead>y.dead;
    }
};
//多个key,重载运算符,que.top()保存的是val最小的
priority_queue<Tpoint>que;

 

posted @ 2013-04-17 12:34  zhang1107  阅读(165)  评论(0编辑  收藏  举报