Cod sursa(job #2893137)

Utilizator catarau.bianca.Bianca Catarau catarau.bianca. Data 25 aprilie 2022 12:21:53
Problema Heapuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.65 kb
#include <bits/stdc++.h>
 
using namespace std;
 
ifstream f ("heapuri.in");
ofstream g ("heapuri.out");
 
vector <int> h;
int ord[200001], n, o, op, a;
 
int main()
{
    f>>n;
    for ( int i = 1; i <= n; i++ )
    {
        f>>op;
        if ( op==1 )
        {
            f>>a;
            h.push_back(a);
            o++;
            ord[o]=a;
        }
        else if (op==2)
            {
                f>>a;
                h.erase(find(h.begin(),h.end(),ord[a]));
            }
        else
            {
                g<<*min_element(h.begin(), h.end());
                g<<"\n";
            }
    }
    return 0;
}