Number of Permutations of 30 numbered balls with restrictions 
In how many ways can one arrange 30 numbered balls in a row, so that:

*

*balls 1-10 are not in places 1-10

*balls 11-20 are not in places 11-20

*balls 21-30 are not in places 21-30


I tried using the Inclusion-Exclusion principle on here, but it doesn't seem to work on this problem.
Thank you.
 A: I don't think there is a closed form formula for this problem. Calling the numbers red, yellow and blue according to their first digit, a first thing one can count is the number of colourings of positions $1$-$30$ points so that none of positions $1$-$10$ are red, none of $11$-$20$ are yellow, and none of $21$-$30$ are blue.
It is easy to see that if $i$ among $11$-$20$ are red, then also $i$ among $21$-$30$ must be yellow and $i$ among $1$-$10$ must be blue (the remaining $10-i$ elements in these groups being respectively blue, red, and yellow). That makes the number of colourings $\sum_{i=0}^{10}\binom{10}i^3=38165260$.
Now one must still map for each colour the numbered balls to the now chosen position, which for each colour can be done in $10!$ ways. All in all $38165260*(10!)^3=1 823 716 485 707 433 246 720 000 000$.
A: For the $1-10$ balls choose $k\in \{1,...,10\}$. For each choose $k$ places in $11-20$ to put the $1-10$ balls and the $10-k$ places in $21-30$ to put the $1-10$ balls. Now once this is done, you have to fill the remaining $11-20$ places with balls $21-30$ and the remaining $21-30$ places with balls $11-20$. Lastly chose the $k$ places in $1-10$ places to put the remaining $k$ balls $11-20$ you did not place. Then fill the rest with $21-30$ balls. 
At last you have :
$$\sum_{k=0}^{10}\begin{pmatrix}10\\k\end{pmatrix}\begin{pmatrix}10\\10-k\end{pmatrix}\begin{pmatrix}10\\k\end{pmatrix}=\sum_{k=0}^{10}\begin{pmatrix}10\\k\end{pmatrix}^3\text{ choices. } $$
A: If $k$ of the balls numbered $1$-$10$ are in places $11$-$20$, that gives you $\binom{10}k^2$ choices for those balls, and then another $\binom{10}k$ choices for the $k$ balls numbered $21$-$30$ in places $1$-$10$, so the total is
$$
\sum_{k=0}^{10}\binom{10}k^3=38165260\;.
$$
P.S.: Looking at Marc's answer, I realize that I counted the number of ways to choose places for the three groups, but you probably intended to differentiate also between balls from the same group; as Marc points out, that yields another factor $(10!)^3$, for all permutations of $3$ groups of $10$ balls each.
