优先队列的创建

 

1.

struct cmp1
{
    bool operator() (int a,int b)
    {
        return f[a]>f[b];    //opp
    }
};


priority_queue<int,vector<int>,cmp1 > a;

 

2.

struct node
{
    ll value;
    int pos,t;
    bool operator<(const node & a) const //第二个const必须有
    {
        return value<a.value;
    }
    bool operator<(const node &a) const
    {
        return value<a.value;
    }
};

 

posted @ 2018-09-11 16:24  congmingyige  阅读(319)  评论(0编辑  收藏  举报