pigeon hole principle [arrangement]

176 Views Asked by At

There are G girl students and B boy students in a class that is about to graduate. You need to arrange them in a single row for the graduation. To give a better impression of diversity, you want to avoid having too many girls or too many boys seating consecutively. You decided to arrange the students in order to minimize the gender regularity. The gender regularity of an arrangement is the maximum number of students of the same gender (all girls or all boys) that appear consecutively. Given G and B, calculate the minimum gender regularity among all possible arrangements.

can someone give me the intuitive approach of solving this problem by using pigeon hole principle?

Link to problem GIRLS AND BOYS

1

There are 1 best solutions below

0
On

Think of the set with the smaller number of students as dividing the row into pigeonholes. If the smaller number is $B$, then there are $B+1$ pigeonholes--one each to the right of each student, plus one at the left end of the row.

So if $G=B+1$ (or $G=B$), girls and boys can alternate, and the regularity is $1$. The regularity is 2 for $(B+1) < G \leq 2(B+1)$, and so on.