Pagini recente » Cod sursa (job #1214573) | Cod sursa (job #917749) | Cod sursa (job #1125961) | Cod sursa (job #377270) | 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;
}