Pagini recente » Cod sursa (job #3341711) | Cod sursa (job #3341873) | Cod sursa (job #3341720) | Cod sursa (job #3331819) | Cod sursa (job #3341722)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int NMAX = 2e5 + 1;
int n, order[NMAX], p = 0;
int main()
{
fin >> n;
multiset<int> heap;
while(n--)
{
int tip;
fin >> tip;
if(tip == 1)
{
int val;
fin >> val;
heap.insert(val);
order[++p] = val;
}
else if(tip == 2)
{
int t;
fin >> t;
auto it = heap.lower_bound(order[t]);
heap.erase(it);
}
else
fout << *heap.begin() << "\n";
}
fin.close();
fout.close();
return 0;
}