Pagini recente » Cod sursa (job #3218294) | Cod sursa (job #1910264) | Cod sursa (job #877647) | Cod sursa (job #1262366) | Cod sursa (job #2737165)
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
set <int> heap;
int pos[200005];
int n, operation, idx, x;
int main()
{
fin>>n;
for (int i = 1; i <= n; i++)
{
fin>>operation;
//while (!heap.empty())
//{
// cout<<*heap.begin()<<endl;
// heap.erase(*heap.begin());
//}
if (operation == 1)
{
fin>>x;
heap.insert(x);
idx += 1;
pos[idx] = x;
}
else if (operation == 2)
{
fin>>x;
heap.erase(pos[x]);
}
else fout<<*heap.begin()<<endl;
}
return 0;
}