## Task B-3.2.

At a dance festival, two dance groups are participating. In the first part of the festival, each dancer performed one dance with every other dancer from their own group. No dancer from one group danced with a dancer from the other group. How many dancers are in each individual group if together they have 42 dancers, and in the first part of the festival, a total of 421 dances were performed? In the second part of the festival, dance pairs are formed, each consisting of one dancer from each dance group. What is the maximum number of such pairs that can be found on the dance floor? (Note: dancers are not distinguished by gender.)
## Solution.

According to the condition of the problem, $a+b=42$, where $a$ is the number of dancers in the first group, and $b$ is the number of dancers in the second group.

The total number of dance pairs formed from all $a$ dancers in the first group is $\frac{a(a-1)}{2}$, and the total number of dance pairs from all $b$ dancers in the second group is $\frac{b(b-1)}{2}$. Therefore,

$$
\frac{a(a-1)}{2}+\frac{b(b-1)}{2}=421
$$

which simplifies to $a^{2}+b^{2}-(a+b)=842$. Substituting $b=42-a$ gives $a^{2}+(42-a)^{2}-42=842$, and after simplification, the quadratic equation $a^{2}-42 a+440=0$ whose solutions are 20 and 22.

Thus, one dance group has 20 members, and the other has 22, or vice versa.

From this, it is clear that the maximum number of mixed dance pairs is 20, and we can select them by first choosing 20 out of 22 dancers from the second group in $\binom{22}{20}=\binom{22}{2}=\frac{22 \cdot 21}{2}=231$ ways, and then arranging them with the 20 dancers from the first group in 20! ways.

Therefore, the total number of possibilities is $\binom{22}{20} \cdot 20!=231 \cdot 20$!.