Cod sursa(job #2744236)

Utilizator Octavian21Chiriac Octavian Octavian21 Data 24 aprilie 2021 02:45:14
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");

set<int> hp;

vector <int> apar;
int main()
{
    int n,i,x,y;
    fin>>n;
    for(i=1;i<=n;++i)
    {
        fin>>x;
        if(x == 1)
        {
            fin>>y;
            hp.insert(y);
            apar.push_back(y);
        }
        else if(x == 2)
        {
            fin>>y;
            hp.erase(apar[y-1]);
        }
        else if(x == 3)
        {
            fout<<*hp.begin()<<"\n";
        }
    }
    return 0;
}