Pagini recente » Cod sursa (job #1749597) | Cod sursa (job #1207837) | Cod sursa (job #2484516) | Cod sursa (job #138527) | Cod sursa (job #1367444)
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
const int INF = 0x3f3f3f3f;
std::ifstream f("heapuri.in");
std::ofstream g("heapuri.out");
std::vector<int> v;
std::multiset<int> mst;
int main()
{
v.push_back(0);
int n; f >> n;
for (int i = 1, op; i <= n; i++) {
f >> op;
if (op == 1) {
int x; f >> x;
v.push_back(x);
mst.insert(x);
}
if (op == 2) {
int x; f >> x;
mst.erase(mst.find(v[x]));
}
if (op == 3) {
g << *mst.begin() << '\n';
}
}
g.flush();
f.close();
g.close();
return 0;
}