Pagini recente » Cod sursa (job #1098659) | Cod sursa (job #663408) | Cod sursa (job #3155576) | Cod sursa (job #3318039) | Cod sursa (job #2761759)
#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;
int k = 0;
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;
}