Pagini recente » Cod sursa (job #2025336) | Cod sursa (job #1150895) | Cod sursa (job #758670) | Cod sursa (job #1032321) | Cod sursa (job #1314684)
#include<stdio.h>
#include<set>
#define FIN "heapuri.in"
#define FOUT "heapuri.out"
#define MAXSIZE 100002
using namespace std;
multiset<int> heap;
int position[MAXSIZE];
int order = 1;
int n;
int main()
{
freopen(FIN, "r", stdin);
freopen(FOUT, "w", stdout);
scanf("%d ", &n);
for(int i=1;i<=n;i++)
{
int x,y;
scanf("%d ", &x);
if(x == 1)
{
scanf("%d ", &y);
heap.insert(y);
position[order] = y;
order++;
}
else if(x == 2)
{
scanf("%d ", &y);
heap.erase(position[y]);
}
else
{
//printf("%d \n", heap.begin());
// for(multiset<int>::iterator it=heap.begin(); it!=heap.end(); it++)
// printf("%d ", *it);
printf("%d \n", *heap.begin());
}
}
return 0;
}