Cod sursa(job #499902)
Utilizator | Data | 10 noiembrie 2010 23:25:18 | |
---|---|---|---|
Problema | Heapuri | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.47 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
printf("%d\n",*heap.begin());
}
return 0;
}