把博客园图标替换成自己的图标
把博客园图标替换成自己的图标end

模板:堆

https://www.luogu.org/problemnew/show/P3378

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<queue>
 5 using namespace std; 
 6 priority_queue<int,vector<int>,greater<int> >q;
 7 int main(){
 8      int n;
 9      scanf("%d",&n);
10      for(int i=1; i<=n; i++){
11           int x;
12           scanf("%d",&x);
13           if(x==1){
14               scanf("%d",&x);
15             q.push(x);
16         }
17       else if(x==2) printf("%d\n",q.top());
18       else     q.pop();       
19      } 
20     return 0;  
21 } 

 

posted @ 2018-07-19 19:08  AZe-qwq  阅读(122)  评论(0编辑  收藏  举报
浏览器标题切换
浏览器标题切换end