Pagini recente » Cod sursa (job #2493050) | Cod sursa (job #305570) | Cod sursa (job #2574012) | Cod sursa (job #1894783) | Cod sursa (job #1611887)
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
const int nmax = 200005;
set <int> heap;
int main()
{
ios_base::sync_with_stdio(false);
int n, op, x, ord[nmax], i, dim=0;
fin >> n;
for(i=1; i<=n; i++)
{
fin >> op;
if(op==1)
{
fin >> x;
ord[++dim]=x;
heap.insert(x);
}
else if(op==2)
{
fin >> x;
heap.erase(ord[x]);
}
else fout << *heap.begin() << "\n";
}
fin.close();
fout.close();
return 0;
}