Cod sursa(job #1804807)
| Utilizator | Data | 13 noiembrie 2016 00:38:08 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include<bits/stdc++.h>
using namespace std;
int n,op,x,v[200005],dv;
multiset<int> 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;
}
