Pagini recente » Cod sursa (job #587205) | Cod sursa (job #1621139) | Cod sursa (job #1623624)
#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()
{
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;
}