Cod sursa(job #2570333)

Utilizator AlexPascu007Pascu Ionut Alexandru AlexPascu007 Data 4 martie 2020 16:12:35
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.47 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int n,cod,x,cnt,v[200010];
set<int> s;
int main() {
    fin>>n;
    while (n--) {
        fin>>cod;
        if (cod==1) {
            fin>>x;
            v[++cnt]=x;
            s.insert(x);
        }
        else if (cod==2) {
            fin>>x;
            s.erase(v[x]);
        }
        else
            fout<<*s.begin()<<"\n";
    }
    return 0;
}