Cod sursa(job #1165530)
Utilizator | Data | 2 aprilie 2014 19:01:17 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.55 kb |
#include <cstdio>
#include <set>
using namespace std;
set <int> heap;
int ord[200005],l,n,i,tipOp,x;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&tipOp);
if (tipOp==1)
{
scanf("%d",&x); ord[++l]=x;
heap.insert(x);
}
else if (tipOp==2)
{
scanf("%d",&x);
heap.erase(ord[x]);
}
else printf("%d\n",*heap.begin());
}
}