Cod sursa(job #398280)

Utilizator MKLOLDragos Ristache MKLOL Data 18 februarie 2010 13:21:53
Problema Heapuri Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include<set>
#include<stdio.h>
using namespace std;
int N,K,x,y;
int l[100000];
set<int> V;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&N);
    for(int i=1;i<=N;++i)
    {
    scanf("%d",&x);
    if(x==1)
    {

    scanf("%d",&y);
    l[++K]=y;
    V.insert(y);
    }
    if(x==2)
    {
    scanf("%d",&y);
    V.erase(l[y]);
    }
    if(x==3)
    printf("%d\n",*V.begin());
    }
}