Pagini recente » Cod sursa (job #1752618) | Cod sursa (job #1795849) | Cod sursa (job #2519078) | Cod sursa (job #3209235) | Cod sursa (job #2743993)
#include <bits/stdc++.h>
using namespace std;
int n, cod, x;
set <int> heap;
vector <int> ordine;
ifstream in ("heapuri.in");
ofstream out ("heapuri.out");
int main()
{
in >> n;
for(int i = 0; i < n; ++i)
{
in >> cod;
if(cod == 1)
{
in >> x;
heap.insert(x);
ordine.push_back(x);
}
else if(cod == 2)
{
in >> x;
heap.erase(ordine[x - 1]);
}
else
out << *heap.begin() << "\n";
}
return 0;
}