Cod sursa(job #2681358)

Utilizator DesertChuStefan Andrei DesertChu Data 5 decembrie 2020 12:03:12
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set <int> h;
int n,i,t,x,pos[200002],nr;
int main()
{
    f>>n;
    for(i=1; i<=n; i++)
    {
        f>>t;
        if(t==3)
        {
            g<<*h.begin()<<'\n';
        }
        else if(t==2)
        {
            f>>x;
            h.erase(pos[x]);
        }
        else
        {
            f>>x;
            h.insert(x);
            pos[++nr]=x;
        }


    }

    return 0;
}