Cod sursa(job #791673)
| Utilizator | Data | 24 septembrie 2012 20:08:54 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include<fstream>
#include<set>
#include<iterator>
using namespace std;
int main()
{
set <int> heap;
int n,i,x,y;
long v[200001],cont;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
cont=0;
for(i=1;i<=n;i++)
{
f>>x;
if(x==1)
{
f>>y;
heap.insert(y);
v[++cont]=y;
}
if(x==3)
{
set <int> ::iterator it = heap.begin();
g<<*it<<endl;
}
if(x==2){
f>>y;
heap.erase(v[y]);
}
}
}
