Cod sursa(job #1318926)

Utilizator GeorgianaMMirlogeanu Georgiana GeorgianaM Data 16 ianuarie 2015 14:55:34
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.56 kb
#include<fstream>
#include<set>

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

int a[1000231];
int n,k,i,poz;
multiset<int> heap;

int main()
{   int x;
    f>>n;
    for (i=1; i<=n ; ++i)
    {   f>>k;

    if (k==1)
        {f>>x;
         a[++poz]=x;
         heap.insert(x);
         }
        if (k==2)
        {
            f>>x;
            heap.erase(heap.find(a[x]));
        }
        if (k==3)
        {
            g<<*heap.begin()<<"\n";

        }

    }
f.close();
g.close();
return 0;
}