Cod sursa(job #2183619)
Utilizator | Data | 23 martie 2018 11:59:50 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include <fstream>
#include <set>
using namespace std;
set <int> heap;
int t,i,a,r,x,poz[200002];
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>t;
for(i=1;i<=t;i=i+1)
{
f>>x;
if(x==1)
{
f>>a;
heap.insert(a);
poz[++r]=a;
}
if(x==2)
{
f>>a;
heap.erase(poz[a]);
}
if(x==3)
g<<*heap.begin()<<'\n';
}
return 0;
}