Pagini recente » Cod sursa (job #1955819) | Cod sursa (job #1066485) | Cod sursa (job #2898196) | Cod sursa (job #1346756) | Cod sursa (job #2368699)
#include <fstream>
#include <set>
#include <unordered_map>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
multiset <int> s;
multiset <int> :: iterator it;
unordered_map<int, int> M;
void Solve ()
{
int n, pos = 0, op, x;
fin >> n;
while (n--)
{
fin >> op;
if (op == 1)
{
fin >> x;
M[++pos] = x;
s.insert(x);
}
else if (op == 2)
{
fin >> x;
s.erase(M[x]);
}
else
{
it = s.begin();
fout << *it << "\n";
}
}
fout.close();
}
int main()
{
Solve();
return 0;
}