Cod sursa(job #424672)
Utilizator | Data | 25 martie 2010 02:22:57 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
//#include "stdafx.h"
#include <stdio.h>
#include <set>
#define NMAX 200100
using namespace std;
set <int> heap;
int x[NMAX],i,n,k,p;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&k);
if (k==3)
printf("%d\n",*heap.begin());
else
{
scanf("%d",&p);
if (k==1)
{
x[++x[0]]=p;
heap.insert(p);
}
else
heap.erase(x[p]);
}
}
return 0;
}