Cod sursa(job #3363482)

Utilizator alex.iovita.23@gmail.comIovita Alexandru [email protected] Data 18 august 2026 16:03:13
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.63 kb
#include<bits/stdc++.h>

using namespace std;

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");

int t;
set<int> s;
vector<int> v;

int main(){
    fin >> t;
    while(t--){
        int tip; fin >> tip;
        if(tip == 1){
            int x; fin >> x;
            v.push_back(x);
            s.insert(x);
        }
        else if(tip == 2){
            int poz; fin >> poz;
            s.erase(v[poz - 1]);
        }
        else{
            int rez;
            for(auto i : s){
                rez = i;
                break;
            }
            fout << rez << '\n';
        }
    }
}