Cod sursa(job #1293896)

Utilizator stiharus96Dovan Andrei Dorinel stiharus96 Data 16 decembrie 2014 18:40:04
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");
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(a[y]);
        }
        else
            g<<*h.begin()<<'\n';
    }
    return 0;
}