Pagini recente » Cod sursa (job #1653625) | Cod sursa (job #2873342) | Cod sursa (job #923277) | Cod sursa (job #1678934) | Cod sursa (job #2896103)
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int> h;
int main()
{
int N, operatie, x, i, pozitie=1, pozitii[200001];
f>>N;
for(i=0; i<N; i++)
{
f>>operatie;
if(operatie==1)
{
f>>x;
h.insert(x);
pozitii[pozitie]=x;
pozitie++;
}
if(operatie==2)
{
f>>x;
h.erase(pozitii[x]);
}
if(operatie==3)
g<<*h.begin()<<'\n';
}
return 0;
}