Cod sursa(job #2847861)

Utilizator loraclorac lorac lorac Data 11 februarie 2022 17:18:44
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
#include <bits/stdc++.h>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
const int lim=2e5+4;
multiset<int> s;
int q,n,t,x;
int v[lim];
int main()
{
    in>>q;
    while(q--)
    {
        in>>t;
        if(t==1)
        {
            in>>v[++n];
            s.insert(v[n]);
        }
        else if(t==2)
        {
            in>>x;
            s.erase(s.find(v[x]));
        }
        else out<<(*s.begin())<<'\n';
    }
    return 0;
}