Pagini recente » Cod sursa (job #1095793) | Cod sursa (job #2240188) | Cod sursa (job #2738236) | Cod sursa (job #1139355) | Cod sursa (job #1732494)
#include<iostream>
#include<fstream>
#include<set>
using namespace std;
const int NMAX = 200001;
multiset <int> heap;
int chrono[NMAX];
int n;
int type;
int value;
int k = 0;
int main ()
{
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
fin >> n;
for(int i=0; i<n; i++)
{
fin >> type;
if(type == 1)
{
fin >> value;
chrono[++k]=value;
heap.insert(value);
}
if(type == 2)
{
fin >> value;
heap.erase(chrono[value]);
}
if(type == 3)
{
fout << *heap.begin() << '\n';
}
}
fin.close();
fout.close();
}