Evanyou Blog 彩带

洛谷P3378堆

传送门啦

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue> 
#define re register
using namespace std;

inline int read(){
	char ch = getchar();
	int f = 1 , x = 0;
	while(ch > '9' || ch < '0') {if(ch == '-') f = -1 ;ch = getchar();}
	while(ch >= '0' && ch <= '9' ) {x = (x << 1) + (x << 3) + ch - '0' ;ch = getchar();}
	return x * f;
}

priority_queue<int , vector <int> , greater <int> > q;

int n,flag,x;

int main(){
	n = read();
	while(n--){
		flag = read();
		if(flag == 1) {
			x = read(); 
			q.push(x);
		}
		else if(flag == 2) {
			printf("%d\n",q.top());
		}
		else q.pop();
	}
	return 0;
}
posted @ 2018-11-08 17:25  Stephen_F  阅读(130)  评论(0编辑  收藏  举报