Cod sursa(job #1049682)

Utilizator Aleks10FMI - Petrache Alex Aleks10 Data 7 decembrie 2013 18:21:00
Problema Heapuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.6 kb
#include <iostream>
#include <fstream>
#include <set>

using namespace std;

set<int> heap;
long long a[200001];
int main()
{
    long long i,j=1,n,x,y;
    ifstream f("heapuri.in");
    ofstream g("heapuri.out");
    f>>n;
    for(i=1;i<=n;i++){
        f>>x;
        if(x==1){
            f>>y;
            heap.insert(y);
            a[j]=y;
            j++;
        }else
        if(x==2){
            f>>y;
            heap.erase(a[y]);
        }else
        if(x==3){
            set<int>:: iterator it=heap.begin();
            cout<<*it<<'\n';
        }
    }
    return 0;
}