Cod sursa(job #3130966)

Utilizator opreaopreacalin@gmail.comCalin Oprea [email protected] Data 18 mai 2023 21:40:54
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.61 kb
#include<iostream>
#include<fstream>
#include<set>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");

int v[200000];
set<int> vfin;
int main(){

    int n, last = 0;
    in >> n;
    for(int i = 0; i < n; i++){
        int op;
        in >> op;
        if(op == 1){
            int x;
            in >> x;
            last++;
            v[last] = x;
            vfin.insert(v[last]);
        }
        else if(op == 2){
            int x;
            in >> x;
            vfin.erase(v[x]);
        }
        else if(op == 3){
            out << *vfin.begin() << '\n';
        }
    }
    return 0;
}