Balls and limited-capacity bins with unique placement

125 Views Asked by At

I am trying to solve the following problem:

Suppose that you are given $M$ indistinct bins and $L$ indistinct balls where $L \geq M(M-1)/2$. In how many ways can we distribute the balls into the bins with the following constraints:

  1. The capacity of each bin is maximum $K$, where $K \geq M$.
  2. Number of balls in each bin is unique, i.e. no two bins have the same number of balls in them. We cannot even have two bins with $0$ balls in them.

We can assume that $L \leq M(2K-M+1)/2$ ($K$ balls in bin $1$, $K-1$ balls in bin $2$, $...$ , $K-M+1$ ball in bin $M$). This condition makes sure that there are enough bins to fit all the balls in.