Pagini recente » Cod sursa (job #1249996) | Cod sursa (job #2479843) | Cod sursa (job #2002855) | Cod sursa (job #1510782) | Cod sursa (job #1553271)
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
multiset <int> S;
int V[200005];
int main()
{
int n,x,op,na=0;
f>>n;
for(int i=1;i<=n;i++)
{
f>>op;
if(op==1 || op==2)
{
f>>x;
if(op==1)
{
S.insert(x);
V[++na]=x;
}
else
{
if(S.find(V[x])!=S.end() && V[x]!=-1)
{
S.erase(V[x]);
V[x]=-1;
}
}
}
else
if(op==3)
{
multiset<int> ::iterator it=S.begin();
g<<*it<<"\n";
}
}
return 0;
}