Cod sursa(job #2952890)

Utilizator hhhhhhhAndrei Boaca hhhhhhh Data 10 decembrie 2022 10:31:06
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.66 kb
#include <bits/stdc++.h>

using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int n;
vector<int> v;
multiset<int> s;
int main()
{
    fin>>n;
    while(n--)
    {
        int tip;
        fin>>tip;
        if(tip==1)
        {
            int x;
            fin>>x;
            s.insert(x);
            v.push_back(x);
            continue;
        }
        if(tip==2)
        {
            int x;
            fin>>x;
            int val=v[x-1];
            s.erase(s.find(val));
            continue;
        }
        if(tip==3)
        {
            fout<<*s.begin()<<'\n';
        }
    }
    return 0;
}