priority_queue

typedef struct data  
{  
    int start,i;  
    data():start(0),i(0){}  
    data(int a, int b):start(a),i(b){}  
}way;  
struct cmp  
{  
    bool operator()(const data &x, const data &y)  
    {  
        return x.start+a[x.i]>y.start+a[y.i];  
    }  
};  
priority_queue< way, vector<way> , cmp > 
priority_queue<int, vector<int>, greater<int> >qi2;

top 访问队头元素
empty 队列是否为空
size 返回队列内元素个数
push 插入元素到队尾 (并排序)
emplace 原地构造一个元素并插入队列
pop 弹出队头元素
swap 交换内容

参考博客

https://blog.csdn.net/weixin_36888577/article/details/79937886

原文地址:https://www.cnblogs.com/xumaomao/p/11258465.html