Pagini recente » Cod sursa (job #2960478) | Cod sursa (job #1663157) | Cod sursa (job #24532) | Cod sursa (job #1344215) | Cod sursa (job #1854748)
#include <fstream>
#include <set>
#define lgmax 200001
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> h;
int poz[lgmax];
int main()
{
multiset<int>::iterator it;
int m,i,op,nr,ct=0;
fin>>m;
for(i=1;i<=m;i++)
{
fin>>op;
if(op==1)
{
fin>>nr;
h.insert(nr);
poz[++ct]=nr;
}
if(op==2)
{
fin>>nr;
h.erase(h.find(poz[nr]));
}
if(op==3)
{
it=h.begin();
fout<<*it<<'\n';
}
}
return 0;
}