Pagini recente » Profil StarGold2 | Cod sursa (job #2361498) | Cod sursa (job #1514940) | Cod sursa (job #2572866) | Cod sursa (job #1315431)
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> heap;
int n, x, y, V[100010], i;
int main()
{
fin >> n;
int poz = 1;
for(i = 1; i <= n;i ++)
{
fin >> x;
if(x == 1)
{
fin >> y;
heap.insert(y);
V[poz] = y;
poz ++;
}
else
if(x == 2)
{
fin >> y;
heap.erase(V[y]);
}
else
fout << *heap.begin() << '\n';
}
return 0;
}