Pagini recente » Cod sursa (job #2566547) | Istoria paginii runda/dopaj | Cod sursa (job #2354846) | Cod sursa (job #1691818) | Cod sursa (job #2893160)
#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<=200000;i++)
if(minim>h[i]&&h[i]!=0)
{minim=h[i];
idx=i;
}
g<<minim;
g<<"\n";
h[idx]=0;
}
}
return 0;
}