Cod sursa(job #2349537)

Utilizator 3DwArDPauliuc Edward 3DwArD Data 20 februarie 2019 15:55:20
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.47 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int v[200050],n,poz;
set<int> heap;
int main()
{
    f>>n;
    for(int k,x;n;n--){
        f>>k;
        if(k==1){
            f>>x;
            heap.insert(x);
            v[++poz]=x;
        }
        if(k==2){
            f>>x;
            heap.erase(v[x]);
        }
        if(k==3){
            g<<*heap.begin()<<"\n";
        }
    }
    return 0;
}