Pagini recente » Cod sursa (job #1062441) | Cod sursa (job #1734297) | Cod sursa (job #326017) | Cod sursa (job #3249257) | Cod sursa (job #2742202)
#include <bits/stdc++.h>
#define nmax 200005
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int>heap;
int poz[nmax], k;
int main()
{
int op, q, x;
fin >> q;
for(; q; q--)
{
fin >> op;
if (op == 1)
{
fin >> x;
poz[++k] = x;
heap.insert(x);
}
else if(op == 2)
{
fin >> x;
heap.erase(poz[x]);
}
else fout << *heap.begin() << "\n";
}
return 0;
}