Pagini recente » Cod sursa (job #1022809) | Cod sursa (job #1536343) | Cod sursa (job #1536347) | Cod sursa (job #1517926) | Cod sursa (job #1739368)
#include <fstream>
#include <set>
#define VAL 200005
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int N, i, op, x;
int v[VAL], p;
multiset<int> heap;
multiset<int> :: iterator it;
int main()
{
fin >> N;
for (i=1; i<=N; i++)
{
fin >> op;
if (op==3)
{
it=heap.begin();
fout << *it << '\n';
}
else
{
if (op==1)
{
fin >> v[++x];
heap.insert(v[x]);
}
else
{
fin >> p;
it=heap.find(v[p]);
heap.erase(*it);
}
}
}
fin.close();
fout.close();
return 0;
}