Cod sursa(job #3130664)

Utilizator theo_scrie_codGhinea Theodor theo_scrie_cod Data 18 mai 2023 13:28:31
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
int main() {
    int n,i,type,x;
    in >> n;
    int v[n+1],l=0;
    set<int> m;
    for(i=1;i<=n;i++){
        in >> type;
        if(type==3){
            out << *m.begin() << endl;
        }
        else{
            in >> x;
            if(type==1){
                v[l++]=x;
                m.insert(x);
            }
            if(type==2)
                m.erase(v[x-1]);
        }


    }
}