Pagini recente » Cod sursa (job #2588546) | Cod sursa (job #461174) | Cod sursa (job #1621589) | Cod sursa (job #1031130) | Cod sursa (job #2566489)
#include <fstream>
#include <iostream>
#include <set>
using namespace std;
const int N = 2e5 + 5;
int ord[N], n;
multiset <int> s;
multiset <int> :: iterator it;
void Read ()
{
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
fin >> n;
int k = 0, op, x;
while (n--)
{
fin >> op;
if (op == 1)
{
fin >> x;
k++;
ord[k] = x;
s.insert(x);
}
else if (op == 2)
{
fin >> x;
s.erase(s.find(ord[x]));
}
else
{
it = s.begin();
fout << *it << "\n";
}
}
fout.close();
fin.close();
}
int main()
{
Read();
return 0;
}