Cod sursa(job #500567)
Utilizator | Data | 12 noiembrie 2010 15:27:42 | |
---|---|---|---|
Problema | Heapuri | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include<stdio.h>
#include<set>
using namespace std;
int n,a,x,k,b[200000];
set<int> v;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&k);
n=1;
while(k!=0)
{
k--;
scanf("%d",&a);
switch(a)
{
case 1:
{
scanf("%d",&x);
v.insert(x);
b[n++]=x;
break;
}
case 2:
{
scanf("%d",&x);
v.erase(b[x]);
break;
}
case 3:
{
printf("%d\n",*v.begin());
break;
}
}
}
return 0;
}