优先队列

// 优先队列
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;

int main(){
    priority_queue<int, vector<int>, less<int>> q;
    priority_queue<int, vector<int>, greater<int>> p;
    // priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> z;
    // z.push({3, 1});
    q.push(2);
    q.push(4);

    while(!q.empty()){
        printf("%d\n", q.top());
        q.pop();
    }

    return 0;
}
posted @ 2021-10-17 23:17  consolexinhun  阅读(14)  评论(0编辑  收藏  举报