Cod sursa(job #2727264)

Utilizator betybety bety bety Data 21 martie 2021 18:17:57
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");
multiset<int> s;
const int lim=2e5+5;
int v[lim],cnt;
int main()
{
    int n,tip,x;
    in>>n;
    while(n--)
    {
        in>>tip;
        if(tip==3)
            out<<(*s.begin())<<'\n';
        else
        {
            in>>x;
            if(tip==1)
            {
                v[++cnt]=x;
                s.insert(x);
            }
            else s.erase(s.find(v[x]));
        }
    }
    return 0;
}