Cod sursa(job #2399054)

Utilizator ezioconnorVlad - Gabriel Iftimescu ezioconnor Data 6 aprilie 2019 19:49:05
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>

using namespace std;

ifstream in("heapuri.in");
ofstream out("heapuri.out");

set <int> q;
int f[200001], k;

int main()
{
    int n, c, x;
    in >> n;
    for (int i = 1; i <= n; ++i)
    {
        in >> c;
        if (c == 1)
        {
            in >> x;
            q.insert(x);
            f[++k] = x;
        }
        else if (c == 2)
        {
            in >> x;
            q.erase(f[x]);
        }
        else
            out << *q.begin() << '\n';
    }
    return 0;
}