void put (int d){
int now ,next;
l++;
heap[l]=d;
now=l;
while(now>1){
next=now>>1;
if(heap[now]>=heap[next]) break;
swap(heap[now],heap[next]);
now=next;
}
}
int get(){
int now,next,res;
res=heap[1];
heap[1]=heap[l];
l–;.
0
now=1;
while(now2<=l){
next=now2;
if(next<l && heap[next]>heap[next+1]) next++;
if(heap[now]<=heap[next]) break;
swap(heap[now],heap[next]);
now=next;
}
return res;
}