Pagini recente » Cod sursa (job #1880970) | Cod sursa (job #1804469) | Profil Versin_Elena | Cod sursa (job #2482984) | Cod sursa (job #2753026)
#include<iostream>
#include<vector>
#include<fstream>
#include<set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int> heap;
vector<int> v;
int n, op, x;
int main() {
f >> n;
while (n--) {
f >> op;
switch(op) {
case 1:
f >> x;
heap.insert(x);
v.push_back(x);
break;
case 2:
f >> x;
heap.erase(v[x - 1]);
break;
case 3:
g << *heap.begin() << "\n";
break;
}
}
}