Pagini recente » Cod sursa (job #2916587) | Cod sursa (job #518236) | Cod sursa (job #2609022) | Cod sursa (job #500260) | Cod sursa (job #2537765)
#include <fstream>
#include <set>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
int main()
{
const int nmax=200005;
int n,poz=0,a[nmax];
fin >> n;
set <int> heap;
for (int i=1;i<=n;i++)
{
int op,x;
fin >> op;
if (op==1)
{
fin >> x;
heap.insert(x);
poz++;
a[poz]=x;
}
else if (op==2)
{
fin >> x;
heap.erase(a[x]);
}
else if (op==3) fout << *heap.begin() << '\n';
}
}