Cod sursa(job #464147)
| Utilizator | Data | 18 iunie 2010 22:43:46 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <fstream>
#include <set>
#define DM 200001
using namespace std;
multiset<int> heap;
multiset<int>::iterator desters;
int poz[DM],nre;
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int op,n,i,el;
f>>n;
f>>op;
for(i=0; i<n; i++,f>>op)
if(op==1) {
f>>el;
poz[++nre]=el;
heap.insert(el);
}
else if(op==2) {
f>>el;
desters=heap.find(poz[el]);
heap.erase(desters);
}
else g<<*heap.begin()<<"\n";
f.close();
g.close();
return 0;
}
