Pagini recente » Cod sursa (job #1982011) | Cod sursa (job #2617361) | Cod sursa (job #934423) | Cod sursa (job #1365342) | Cod sursa (job #1049682)
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
set<int> heap;
long long a[200001];
int main()
{
long long i,j=1,n,x,y;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
for(i=1;i<=n;i++){
f>>x;
if(x==1){
f>>y;
heap.insert(y);
a[j]=y;
j++;
}else
if(x==2){
f>>y;
heap.erase(a[y]);
}else
if(x==3){
set<int>:: iterator it=heap.begin();
cout<<*it<<'\n';
}
}
return 0;
}