Cod sursa(job #751455)
| Utilizator | Data | 26 mai 2012 09:56:39 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include<fstream>
#include<set>
#include<vector>
using namespace std;
int v[200001];
set<int> heap;
int main()
{
int k=0,tip=0,x=0,val=0;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
fin>>k;
for(;k;--k)
{
fin>>tip;
if(tip==3)
fout<<*heap.begin() <<'\n';
else
{
fin>>x;
if(tip==2)
heap.erase(v[x]);
else
{
v[++val]=x;
heap.insert(x);
}
}
}
return 0;
}
