Pagini recente » tema | Cod sursa (job #381212) | tema | Cod sursa (job #211846) | Cod sursa (job #2761769)
#include<iostream>
#include<fstream>
#include <set>
#include <vector>
using namespace std;
ifstream fin("heapuri.in");
ofstream g("heapuri.out");
int n;
int comanda, x;
set<int>heap;
vector <int> v;
int main() {
fin >> n;
v.push_back(-1);
for (int i = 1; i <= n; i++) {
fin >> comanda;
if (comanda == 1) {
fin >> x;
v.push_back(x);
heap.insert(x);
}
else if (comanda == 2)
{
fin >> x;
heap.erase(v[x]);
}
else g << *heap.begin() << "\n";
}
fin.close();
g.close();
return 0;
}