Here is an example that may make the things clear. (It is not a solution by example, but a way to visualize the solution using a special example.)
Note: In an initial version of the question, the solution was linked to
AOPS Problem + Solutions .
This page may have a shorter or longer life, but next days it will be there, so the reader may want to look at the many solutions having one common idea.
Let us build a configuration, by placing some stars on the white fields of the following empty board, already divided in $2\times2$-squares.
The fill-in-rule wants that no two (at a corner) touching white fields
(from the same and/or touching $2\times2$-squares)
get stars in the same time. And each $2\times2$-square has exactly one star (in a white field).
$$
\begin{array}{|cc|cc|cc|cc|cc|}
\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
\end{array}
$$
In this choice, the left upper corner is white.
If the checker board is "the other one", just use a vertical reflection to reduce to this case (since the right upper corner is than white, so the reflection fits the above pattern).
When we use the left/upper field, than we also use the red color:
$$
\begin{array}{|cc|}
\hline
\color{red}*& \blacksquare \\
\blacksquare &
\\\hline
\end{array}
\text{ and abbreviate this as }
\color{red}{\blacksquare}
$$
When we use the right/lower field, than we also use the blue color:
$$
\begin{array}{|cc|}
\hline
& \blacksquare \\
\blacksquare & \color{blue}*
\\\hline
\end{array}
\text{ and abbreviate this as }
\color{blue}{\blacksquare}
$$
Now we will fill in first the first row only, one $2\times2$-square after the next one, starting from left to right.
A first observation is that if somewhere on this row we use the blue pattern, than all (right) following $2\times2$-squares are blue.
So the first row may be
$$
\begin{array}{|cc|cc|cc|cc|cc|}
\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}* &
\blacksquare & \color{blue}* &
\blacksquare & \color{blue}*
\\\hline
\end{array}
$$
and we encode it for short simply as:
$$
\color{red}{\blacksquare \blacksquare }\color{blue}{\blacksquare \blacksquare \blacksquare }
$$
This "simple scheme" to represent the filling is the key to the solution.
Let us fill now the first two rows, and observe the constraints.
First of all we must have in the simple scheme blue under blue, i.e.
$$
\color{red}{\blacksquare \blacksquare }\color{blue}{\blacksquare \blacksquare \blacksquare }
\\
\color{gray}{\blacksquare \blacksquare }\color{blue}{\blacksquare \blacksquare \blacksquare }
$$
and the gray squares have some choices. But each choice should give connected intervals of $\color{red}{\blacksquare}$ and of $\color{blue}{\blacksquare}$ pieces in the "simple scheme".
With this convention, the possible solution
$$
\begin{array}{|cc|cc|cc|cc|cc|}
\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\end{array}
$$
is translated in simple scheme as
$$
\begin{array}{ccccc}
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare
\\
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\end{array}
$$
and the social distancing of red and blue translates further as a record or the right most red square, its column number, considered row after row.
So the above simple scheme translates as the tuple:
$$
(5,3,3,2,1,0)\ .
$$
There are $6$ entries, so many as the rows, and the entries are non-increasing.
Since we hate repetitions in the tuple, we will do the following new translation. Add on its last entry $\color{magenta}1$, on the forelast entry $\color{magenta}2$, and so on, $\color{magenta}3,\color{magenta}4,\color{magenta}5,\color{magenta}6$, so that the new tuple becomes
$$
(5+\color{magenta}6, 3+\color{magenta}5,3+\color{magenta}4,2+\color{magenta}3,1+\color{magenta}2,0+\color{magenta}1)=
(11, 8,7,5,3,1)\ .
$$
This last tuple has six different entries between $1$ and $5+\color{magenta}6$.
By following this encoding process in reverse order, we observe that this makes sense (injectivity of the map), and decoding each tuple obtained from decreasingly rearranging an element of the appropriate $\binom {5+6}6$ combinations also makes sense (surjectivity of the encoding, when the codomain is made out of these combinations).
The general case works along the same lines. Just use $m,n$ instead of $6,5$.
Best Answer
Let there be a total of $a$ ounces of milk. Let the $k^{th}$ dwarf have $x_k^{(0)}$ ounces of milk initially.
Let do it for smaller cases to guess the pattern. It is evident that the last dwarf has $0$ milk initially.
For $n=2$: Then $x_1^{(0)} = a$ and $x_2^{(0)} = 0$.
For $n=3$: Then $$x_1^{(1)} =0; \,\,\,\,x_2^{(1)} =x_2^{(0)} + \dfrac{x_1^{(0)}}2; \,\,\,\,x_3^{(1)} =\dfrac{x_1^{(0)}}2$$ Then $$x_1^{(2)} =\dfrac{x_2^{(0)} + \dfrac{x_1^{(0)}}2}2; \,\,\,\,x_2^{(2)} =0; \,\,\,\,x_3^{(2)} =\dfrac{x_1^{(0)}}2 + \dfrac{x_2^{(0)} + \dfrac{x_1^{(0)}}2}2$$ Then $$x_1^{(3)} =\dfrac{x_2^{(0)} + \dfrac{x_1^{(0)}}2}2 + \dfrac{\dfrac{x_1^{(0)}}2 + \dfrac{x_2^{(0)} + \dfrac{x_1^{(0)}}2}2}2; \,\,\,\,x_2^{(2)} =\dfrac{\dfrac{x_1^{(0)}}2 + \dfrac{x_2^{(0)} + \dfrac{x_1^{(0)}}2}2}2; \,\,\,\,x_3^{(2)} = 0$$ Hence, $$x_1^{(0)} = \left(\dfrac12 + \dfrac18\right)x_1^{(0)} + \left(\dfrac12 + \dfrac14\right)x_2^{(0)}$$ $$x_2^{(0)} = \left(\dfrac14 + \dfrac18\right)x_1^{(0)} + \left(\dfrac14\right)x_2^{(0)}$$ This gives us $x_1^{(0)} = 2x_2^{(0)} \implies x_1^{(0)} = \dfrac{2a}3$ and $x_2^{(0)} = \dfrac{a}3$.
This leads us to a possible guess if there are $n$ dwarfs i.e. $$x_k^{(0)} = (n-k)y$$ such that $$\sum_{k=1}^n x_k^{(0)} = a \implies y = \dfrac{2a}{n(n-1)}$$ i.e. for $7$ dwarfs, we have \begin{align} x_1^{(0)} & = 6y\\ x_2^{(0)} & = 5y\\ x_3^{(0)} & = 4y\\ x_4^{(0)} & = 3y\\ x_5^{(0)} & = 2y\\ x_6^{(0)} & = y\\ x_7^{(0)} & = 0 \end{align} where $y=2$. (Because $y+2y+3y+4y+5y+6y = 42 \implies 21y = 42 \implies y=2$). At transfer $k$, the $k^{th}$ dwarf has $6y$ ounce of milk and transfer to each other dwarf $y$ ounce of milk.
In general, if there are $n$ dwarfs and the total milk is $a$ ounces, and if the $k^{th}$ dwarf has $x_k^{(0)}$ of milk to begin with then $$x_k^{(0)} = \dfrac{2(n-k)}{n(n-1)}a$$