Cod sursa(job #714805)
Utilizator | Data | 16 martie 2012 10:21:12 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include<fstream>
#include<set>
#include<vector>
using namespace std;
vector<int> poz(1);
multiset<int> heap;
int main()
{
int k,tip,x;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
fin>>k;
poz.reserve(k+1);
++k;
while(--k)
{
fin>>tip;
if(tip==3)
fout<<*heap.begin() <<'\n';
else
{
fin>>x;
if(tip==2)
heap.erase(heap.find(poz[x]));
else
{
poz.push_back(x);
heap.insert(x);
}
}
}
return 0;
}