Pagini recente » Cod sursa (job #455278) | Cod sursa (job #1646975) | Cod sursa (job #413179) | Cod sursa (job #418215) | Cod sursa (job #3124215)
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
std::ifstream f("heapuri.in");
std::ofstream g("heapuri.out");
std::set<int> heap;
std::vector <int> v;
int main()
{
int n, operatie, x;
f >> n;
for (int i = 0; i < n; i++)
{
f >> operatie;
if (operatie == 1)
{
f >> x;
heap.insert(x);
v.push_back(x);
}
else if (operatie == 2)
{
f >> x;
heap.erase(v[x - 1]);
}
else
{
g << *heap.begin() << "\n";
}
}
}