Cod sursa(job #2868405)

Utilizator valentina_veleatVeleat Valentina-Georgiana valentina_veleat Data 10 martie 2022 21:55:23
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int>S;
queue<int>q;
int n,a[200005],nr,x,op;
int main()
{
    f>>n;
    while(n--)
    {
        f>>op;
        if(op==1)
        {
            f>>x;
            S.insert(x);
            a[++nr]=x;
        }
        else if(op==2)
        {
            f>>x;
            S.erase(a[x]);
        }
        else
        {
            for(auto i:S)
            {
                g<<i<<'\n';
                break;
            }
        }
    }
    return 0;
}