Pagini recente » Cod sursa (job #2746009) | Cod sursa (job #85713) | Cod sursa (job #772675) | Cod sursa (job #570869) | Cod sursa (job #2772298)
#include <iostream>
#include <fstream>
#include<set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int>h;
int main()
{
int N,v[200001];
f>>N;
int comanda,x,i,k=1;
for(i=1; i<=N; i++)
{
f>>comanda;
if(comanda==1)
{
f>>x;
h.insert(x);
v[k]=x;
k++;
}
else if(comanda==2)
{
f>>x;
h.erase(v[x]);
}
else
{
auto it=h.begin();
g<<*it<<'\n';
}
}
return 0;
}