Cod sursa(job #2681294)

Utilizator Desiree_ClaryArmaczki Alexandra Desiree_Clary Data 5 decembrie 2020 11:21:44
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.44 kb
#include <fstream>
#include<set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int>h;
int poz[200001];
int n,p,k,x;
int main()
{
   f>>n;
   for(int i=1;i<=n;i++)
   {
       f>>p;
       if(p==1)
       {
           f>>x;
           h.insert(x);
           poz[++k]=x;
       }
       else if(p==2)
       {
           f>>x;
           h.erase(poz[x]);
       }
       else g<<*h.begin()<<'\n';
   }
    return 0;
}