Cod sursa(job #3163239)

Utilizator JungwonPreppy Girl Jungwon Data 31 octombrie 2023 09:37:45
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("heapuri.in");
ofstream g("heapuri.out");

set <int> s;
int n,op,x,pozitie,poz[200001],k;
int main()
{
    f>>n;
    for(int i=1;i<=n;i++)
    {
        f>>op;
        if(op==1)
        {
            f>>x;
            poz[++k]=x;
            s.insert(x);
        }
        if(op==2)
        {
            f>>pozitie;
            s.erase(poz[pozitie]);
        }
        if(op==3)
            g<<*s.begin()<<'\n';
    }
    return 0;
}