Pagini recente » Cod sursa (job #2528122) | Cod sursa (job #1272195) | Cod sursa (job #954986) | Cod sursa (job #3157753) | Cod sursa (job #2746742)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
long long N,opt,x,poz,ordine[200005];
set<long long> heap;
int main()
{
fin>>N;
for(int i=1; i<=N; ++i)
{
fin>>opt; if(opt!=3) fin>>x;
switch(opt)
{
case 1:
{
heap.insert(x);
ordine[++poz]=x;
break;
}
case 2:
{
heap.erase(ordine[x]);
break;
}
case 3:
{
fout<<*heap.begin()<<"\n";
break;
}
}
}
return 0;
}