Cod sursa(job #1318921)

Utilizator GeorgianaMMirlogeanu Georgiana GeorgianaM Data 16 ianuarie 2015 14:52:13
Problema Heapuri Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include<fstream>
#include<set>

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

int a[100000];
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;
}