Cod sursa(job #913825)
Utilizator | Hancu Andrei ucnah | Data | 13 martie 2013 19:53:52 |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.66 kb |
#include <cstdio>
#include <set>
using namespace std;
set <int> b;
int comanda,n,x;
int poz[200010],nr;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&comanda);
if(comanda==3)
{
printf("%d\n",*b.begin());
}
else
{
scanf("%d",&x);
if(comanda==1)
{
b.insert(x);
poz[++nr]=x;
}
else
{
b.erase(*b.find(poz[x]));
}
}
}
return 0;
}