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