Pagini recente » Cod sursa (job #2032183) | Cod sursa (job #2551269) | Cod sursa (job #983339) | Cod sursa (job #2974397) | Cod sursa (job #1804803)
#include<bits/stdc++.h>
using namespace std;
typedef struct comparator
{
bool operator()(int i,int j)
{
return i<j;
}
};
int n,op,x,v[200005],dv;
multiset<int,comparator> heap;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&op);
if(op==1)
{
scanf("%d",&x);
heap.insert(x);
v[++dv]=x;
}
else
if(op==2)
{
scanf("%d",&x);
heap.erase(v[x]);
}
else
{
printf("%d\n",*heap.begin());
}
}
return 0;
}