#include <iostream>
#include <stdio.h>
#include<string.h>
#include <queue>
using namespace std;
struct node
{
int a,b;
friend bool operator <(node x,node y)
{
return x.a>y.a; //如果为 >优先级小的先出队列 反之
}
};
priority_queue<node> q;
int main()
{
node a[10];
for(int i=0; i<10; i++)
{
scanf("%d %d",&a[i].a,&a[i].b);
q.push(a[i]);
node b;
b=q.top();
printf(">>>%d %d\n",b.a,b.b);
}
return 0;
}
</pre><pre name="code" class="cpp">
出队列按照一定优先级出队列 ,见下图
图一 图二