Pagini recente » Cod sursa (job #1134904) | Cod sursa (job #1086639) | Cod sursa (job #534850) | may_you_do_it | Cod sursa (job #2623653)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> heap;
int n, loc, v[200005];
int main()
{
int choice, value;
fin >> n;
for (int i = 0; i < n; i++)
{
fin >> choice;
if (choice == 1)
{
fin >> value;
heap.insert(value);
v[++loc] = value;
}
else if (choice == 2)
{
fin >> value;
heap.erase(v[value]);
}
else
{
fout << *heap.begin() << "\n";
}
}
return 0;
}