Cod sursa(job #499903)
| Utilizator | Data | 10 noiembrie 2010 23:26:32 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <stdio.h>
#include <set>
using namespace std;
set<int> heap;
int i,n,sw,x,v[200002],m;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
m=0;
for(i=1;i<=n;i++)
{
scanf("%d",&sw);
if(sw==1)
{
scanf("%d",&x);
v[++m]=x;
heap.insert(x);
}
else
if(sw==2)
{
scanf("%d",&x);
heap.erase(v[x]);
}
else
if(sw==3) printf("%d\n",*heap.begin());
}
return 0;
}
