Cod sursa(job #2086061)
| Utilizator | Data | 11 decembrie 2017 11:47:53 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.68 kb |
#include <bits/stdc++.h>
using namespace std;
multiset<int>heap;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
vector<int>poz;
int main()
{
int op ;
in >> op ;
for (int i =1 ; i <= op ; ++ i )
{
int c, x;
in >>c;
if(c == 1 )
{
in >>x;
heap.insert(x);
poz.push_back(x);
}
else if(c==3){
multiset <int>::iterator it;
it = heap.begin();
out << *it<<"\n";
}
else {
in >> x ;
heap.erase(heap.find(poz[x-1]));
}
}
}
