Pagini recente » Cod sursa (job #2309269) | Cod sursa (job #2132297)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
map <int, int> m;
multiset <int> s;
multiset <int> :: iterator it;
int main()
{
int x, op, y, i = 0, j;
fin >> op;
while (op--)
{
/// citesc operatia
fin >> x;
if (x == 1)
{
/// citesc valoare introdusa
fin >> y;
i++;
m[i] = y;
s.insert(y);
}
else if (x == 2)
{
fin >> y;
///m[y] = 0;
j = m[y];
it = s.find(j);
s.erase(it);
}
else /// x == 3
{
fout << *s.begin() << "\n";
}
}
fin.close();
fout.close();
return 0;
}