ACM模板——优先队列

#include <bits/stdc++.h>
using namespace std;

#define _for(i,a,b) for(int i = (a);i < (b);i ++)
const int maxn = 50003;

struct cmp
{
    bool operator() (const int a,const int b) const
    {
        return a%10 > b%10;
    }
};

int main()
{
    priority_queue<int,vector<int>,cmp> pq;
    pq.push(38);
    pq.push(46);
    pq.push(52);
    pq.push(21);
    int a = pq.top();
    pq.pop();
    cout << a << endl;
    a = pq.top();
    cout << a << endl;
    return 0;
}
优先队列

 

posted @ 2019-03-01 16:24  Asurudo  阅读(113)  评论(0编辑  收藏  举报