Pagini recente » Cod sursa (job #3197293) | Cod sursa (job #2647551) | Cod sursa (job #48322) | Cod sursa (job #2175998) | Cod sursa (job #2086061)
#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]));
}
}
}