Cod sursa(job #2367550)

Utilizator Alex221Dumitru Alexandru Alex221 Data 5 martie 2019 11:21:45
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.43 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
vector <int> v;
set <int> heap;
int n,x,caz;
int main()
{ f>>n;
  for(int i=1;i<=n;i++)
  { f>>caz;
     if(caz==1)
     { f>>x;
       v.push_back(x);
       heap.insert(x);
     }
     else
        if(caz==2)
     { f>>x;
       heap.erase(v[x-1]);
     }
     else
        g<<*heap.begin()<<'\n';
  }
    return 0;
}