Cod sursa(job #984313)

Utilizator Johny_Depp22Johnny Depp Johny_Depp22 Data 14 august 2013 00:58:46
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <fstream>
#include <set>
using namespace std;

ifstream f("heapuri.in");
ofstream g("heapuri.out");

int n, tip, x, a[200005], dim=0;
multiset < int > heap;

int main()
{
    f>>n;
    for (int i=1; i<=n; i++)
    {
        f>>tip;
        if (tip==1)
        {
            f>>x; heap.insert(x); a[++dim]=x;
        }
        else if (tip==2)
        {
            f>>x; heap.erase(a[x]);
        }
        else g<<*heap.begin()<<'\n';
    }

    return 0;
}