Pagini recente » Cod sursa (job #1509797) | Cod sursa (job #1765358) | Istoria paginii runda/xvfmn | Cod sursa (job #2891142) | Cod sursa (job #2365970)
#include <fstream>
#include <vector>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int N;
set <int> heap;
vector <int> ins;
int main()
{
fin >> N;
int type, x;
for(int i = 1; i <= N; i++)
{
fin >> type;
if(type == 1)
{
fin >> x;
ins.push_back(x);
heap.insert(x);
}
else if(type == 2)
{
fin >> x;
heap.erase(ins[x - 1]);
}
else
fout << *heap.begin() << '\n';
}
return 0;
}