Cod sursa(job #1293888)

Utilizator stiharus96Dovan Andrei Dorinel stiharus96 Data 16 decembrie 2014 18:34:57
Problema Heapuri Scor 10
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");
set <int>h;
int n,x,k,y,a[200001];
int main()
{
    f>>n;
    for(int i=1;i<=n;i++)
    {
        f>>x;
        if(x==1)
        {
            f>>y;
            h.insert(y);
            a[++k]=y;
        }
       else if(x==2)
        {
            f>>y;
            h.erase(h.find(a[y]));


        }
       else
        g<<*h.begin()<<'\n';
    }
    return 0;
}