Pagini recente » Cod sursa (job #1358348) | Cod sursa (job #270858) | Cod sursa (job #2960574) | Cod sursa (job #2933613) | Cod sursa (job #2747481)
#include <set>
#include <vector>
#include <fstream>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int N, x, op, idx, i;
#define nrmax 200010
vector <int> pos(nrmax);
set <int> heap;
int main()
{
f >> N;
for (i = 0; i < N; ++i)
{
f >> op;
if (op == 1)
{
f >> x;
heap.insert(x);
pos[++idx] = x;
}
else if (op == 2)
{
f >> x;
heap.erase(pos[x]);
}
else
{
g << *heap.begin() << endl;
}
}
}