Pagini recente » Istoria paginii utilizator/2amazing4me | Monitorul de evaluare | Cod sursa (job #2010592) | Cod sursa (job #2279984) | Cod sursa (job #2893159)
#include <bits/stdc++.h>
using namespace std;
ifstream f ("heapuri.in");
ofstream g ("heapuri.out");
int h[200001];
int ord[200001], n, o, op, a;
int main()
{
f>>n;
for ( int i = 1; i <= n; i++ )
{
f>>op;
if ( op==1 )
{
f>>a;
h[i]=a;
o++;
ord[o]=a;
}
else if (op==2)
{
f>>a;
h[i]=0;
}
else
{
int idx=-1;
int minim=99999;
for(int i=1; i<=200001;i++)
if(minim>h[i]&&h[i]!=0)
{minim=h[i];
idx=i;
}
g<<minim;
g<<"\n";
h[idx]=0;
}
}
return 0;
}