Cod sursa(job #2222338)

Utilizator Moise_AndreiMoise Andrei Moise_Andrei Data 16 iulie 2018 21:37:11
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.57 kb
#include <bits/stdc++.h>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
set <int> h;
int v[200005];
int main()
{
    int n;
    in >> n;
    int poz = 0;
    for(int i = 1; i <= n; i++)
    {
        int c;
        in >> c;
        if(c == 1)
        {
            poz ++;
            in >> v[poz];
            h.insert(v[poz]);
        }
        else if(c == 2)
        {
            int x;
            in >> x;
            h.erase(v[x]);
        }
        else
            out << *h.begin() << '\n';
    }
    return 0;
}