Cod sursa(job #3281433)

Utilizator tomavladnicolae@gmail.comTomavlad [email protected] Data 1 martie 2025 15:29:53
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 kb
#include <bits/stdc++.h>

using namespace std;

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

int q, st[200005], top;
multiset <int> M;


int main()
{
    int op, x;
    fin >> q;
    while (q--)
    {
        fin >> op;
        if (op == 1)
        {
            fin >> x;
            st[++top] = x;
            M.insert(x);
        }
        else if (op == 2)
        {
            fin >> x;
            M.erase(M.find(st[x]));
        }
        else
        {
            fout << *M.begin() << "\n";
        }
    }

    return 0;
}