Pagini recente » Cod sursa (job #2203794) | Cod sursa (job #2523619) | Cod sursa (job #883854) | Cod sursa (job #2516374) | Cod sursa (job #2744786)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int> heap;
int poz[200000],n,op,x,cont=1;
int main()
{
fin>>n;
for(int i = 0; i < n; i++){
fin>>op;
if(op == 1){
fin>>x;
poz[cont] = x;
cont++;
heap.insert(x);
}
else if(op == 2){
fin>>x;
heap.erase(poz[x]);
}
else if(op == 3){
set <int> :: iterator it = heap.begin();
fout<<*it<<endl;
}
}
return 0;
}