Cod sursa(job #303362)
| Utilizator | Data | 9 aprilie 2009 19:49:28 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <stdio.h>
#include <set>
using namespace std;
int main()
{
freopen ("heapuri.in","r",stdin);
freopen ("heapuri.out","w",stdout);
int n,l=0,i,x,y;
int v[200001];
multiset<int>heap;
scanf ("%d",&n);
for (i=1;i<=n;++i){
scanf ("%d",&x);
if (x==1){
scanf ("%d",&y);
heap.insert(y);
v[++l]=y;
}
if (x==2){
scanf ("%d",&y);
heap.erase(heap.find(v[y]));
}
if (x==3)
printf("%d\n",*heap.begin());
}
return 0;
}
