Pagini recente » Cod sursa (job #1684784) | Cod sursa (job #2059974) | Cod sursa (job #1764853) | Cod sursa (job #2290046) | Cod sursa (job #2227093)
#include <bits/stdc++.h>
#define fisiere 1
using namespace std;
/**************************************
*completeaza numele fisiereleor aici *
**************************************/
const string NUME_PROGRAM="heapuri";
#if fisiere==1
ifstream f(NUME_PROGRAM+".in");
ofstream g(NUME_PROGRAM+".out");
#endif // fisiere
const int N = 200010;
int m,k,x,cod,v[N];
set<int> s;
int main()
{
f>>m;
for(;m;m--)
{
f>>cod;
if(cod==3)
{
g<<*s.begin()<<'\n';
}
else
{
f>>x;
if(cod==1)
{
k++;
v[k]=x;
s.insert(x);
}
else
{
x=v[x];
s.erase(x);
}
}
}
return 0;
}