P3378 【模板】堆

P3378 【模板】堆

#include<bits/stdc++.h>
using namespace std;
priority_queue<int,vector<int>,greater<int> >q;//小根堆
int n;
int op;
int x;
int main(){
	scanf("%d",&n);
	while(n--){
		scanf("%d",&op);
		if(op==1){
			scanf("%d",&x);
			q.push(x);
		} else if(op==2){
			printf("%d\n",q.top());
		} else {
			q.pop();
		}
	}
	return 0;
}

 

posted @ 2020-06-29 18:01  LightyaChoo  阅读(122)  评论(0编辑  收藏  举报