Cod sursa(job #1875128)

Utilizator andreeainfo_dAndreea Dutulescu andreeainfo_d Data 10 februarie 2017 19:11:05
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.57 kb
#include <bits/stdc++.h>
using namespace std;
int q,n,cod,x,a[200005];
set <int> sety;
int main()
{
    freopen("heapuri.in","r",stdin);
    freopen("heapuri.out","w",stdout);
    scanf("%d",&q);
    while(q)
    {
        q--;
        scanf("%d",&cod);
        if(cod==1)
        {
            scanf("%d",&x);
            sety.insert(x);
            n++;
            a[n]=x;
        }
        if(cod==2)
        {
            scanf("%d",&x);
            sety.erase(a[x]);
        }
        if(cod==3)printf("%d\n",*sety.begin());
    }
    return 0;
}