Pagini recente » Cod sursa (job #2087320) | Cod sursa (job #459085) | Cod sursa (job #1863906) | Cod sursa (job #1491938) | Cod sursa (job #2761750)
#include<iostream>
#include<fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream gout("heapuri.out");
set<int>heap;
int v[200001];
int main() {
int n;
fin >> n;
int comanda, x;
int k = 0;
for (int i = 0; i < n; i++) {
fin >> comanda;
if (comanda == 1) {
fin >> x;
k++;
v[k] = x;
heap.insert(x);
}
else {
if (comanda == 2) {
fin >> x;
heap.erase(v[x]);
}
else {
if (comanda == 3) {
gout << *heap.begin() << endl;
}
}
}
}
fin.close();
gout.close();
return 0;
}