local function meld(node1,node2) if not node1 then return node2 elseif not node2 then return node1 elseif node1[1]n then A[1]=A[1]+math.floor(b[j-n]/2) A[2]=A[2]+1 pq:push(A[1]*100000+A[2],A) else A[1]=A[1]+math.floor(b[j]/2) A[2]=A[2]+1 pq:push(A[1]*100000+A[2],A) end end local max=0 for j=1,n do local A=pq:top() pq:pop() max=math.max(A[2],max) end min=math.min(max,min) end print(string.format("%d",min))