Combinatorics Problem (Getting off a elevator)

combinatoricsinclusion-exclusion

In how many $3$ males and $2$ females can get down from a lift in a building, having $5$ floors , such that at any floor, a lone pair of male and female is not allowed$?$

My attempt:

Since there are $5$ floors for any person to get off onto total ways would be $5^5$.

To construct a lone pair, one has $3$ choices for the male and $2$ choices for the female ,In total $\frac{3\cdot2}{2}$ ways (ignoring order).
And the resulting $2$ males and $1$ female and a pair have $5\cdot4^3$ ways.(Since other people can't get off at the floor the pair leaves.)

But we would have overcounted when there would be $2$ pairs which can get off in $5\cdot4\cdot3$ ways ($2$ pairs and one male). And we construct this in $\frac{3\cdot2}{2}$ for first pair and $\frac{2\cdot1}{2}$ for second pair, totalling $4$ ways.

So the answer should be $5^5-3\cdot5\cdot4^3+4\cdot5\cdot4\cdot3$

But this is completely wrong and the correct answer is $1973$.

Could anybody point out mistakes in my counting method and suggest an appropriate way to proceed.

Thanks a lot.

Best Answer

Right, it's inclusion-exclusion principle in the end, but not that way.
I will write down the solution for the answer of $1973$, where the unacceptable ways (out of total unrestricted $5^5$) are only when a man stays with a woman alone in the elevator on the $k$th floor and maybe below (this idea contributes to the deleted Brian M. Scott's answer and reads "we must also exclude all ways that have a man and a woman as the last two occupying the elevator, even if they get off on different floors").
We can choose the two ones left in $2\cdot 3$ ways and the floors they get off in $k^2$ ways. So let's say all the left off people except the couple left off on $5$th to $(k+1)$th floors inclusive and $k$th is the first floor, counting top to bottom, where a man and a women left alone.
It's clear that the total number of ways that $3$ distingushable people can leave off on $5-k$ floors is $(5-k)^3$ but we should exclude the cases when all of them left exactly before (i.e. upper than) $(k+1)$th floor, so now we apply the incusion-exclusion principle to get $1^3$ for $k=4$, $2^3-1^3=7$ for $k=3$, $3^3-2^3=19$ for $k=2$ and $4^3-3^3=37$ for $k=1$,
with the total number of excluded cases $6\sum\limits_{k=1}^{4}k^2((5-k)^3-(4-k)^3)=1152$ the answer is $$3125-1152=1973.$$

Related Question