Pagini recente » Cod sursa (job #388337) | Cod sursa (job #1083172) | Ciorna | Cod sursa (job #1228074) | Cod sursa (job #464147)
Cod sursa(job #464147)
#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;
}