Only two colourings
transcript
Some pairs of users must be apart. Put every user in one of two rooms. How many ways are there? Do not try them all. Here is why.
Give the first user room zero. Its neighbours must take room one. The last user is forced to zero. Every choice was forced.
Pick one user's room. Everyone else in the group follows. So each group has two ways.
Twenty users have a million assignments. Ten groups have only 1,024 valid ways.
Some users are pinned to a room. Try the colouring, then its swap. If neither fits, the answer is no.
Count the groups. Call it c. Each group can swap its two rooms. The answer is two to the c.
Counts grow fast. Forty users make forty groups. The raw count is over a trillion. Reduce modulo a prime at every doubling.
One choice fixes the group. So count groups, not ways. Take the modulus. Full breakdown in the lecture.