Pagini recente » telefon3 | Galerie | Monitorul de evaluare | Infasuratoare convexa | Cod sursa (job #3295931)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int a[200005], k;
multiset<int> M;
multiset<int> :: iterator it;
int main()
{
int i, m, op, x;
fin >> m;
while(m)
{
fin >> op;
if(op < 3)
{
fin >> x;
if(op == 1)
{
k++;
a[k] = x;
M.insert(x);
}
else{
it = M.find(a[x]);
M.erase(it);
}
}
else fout << *M.begin() << "\n";
m--;
}
fout.close();
return 0;
}