Problem 673
Beds and Desks
At Euler University, each of the
Some of the beds are in private rooms which a student occupies alone, while the others are in double rooms occupied by two students as roommates. Similarly, each desk is either a single desk for the sole use of one student, or a twin desk at which two students sit together as desk partners.
We represent the bed and desk sharing arrangements each by a list of pairs of student numbers. For example, with
The new chancellor of the university decides to change the organisation of beds and desks: a permutation
The students agree to this change, under the conditions that:
- Any two students currently sharing a room will still be roommates.
- Any two students currently sharing a desk will still be desk partners.
In the example above, there are only two ways to satisfy these conditions: either take no action (
With
With
and desk pairing
then among the
The downloadable text files beds.txt and desks.txt contain pairings for
1,3 2,4
With these pairings, find the number of permutations that satisfy the students’ conditions. Give your answer modulo
床位和座位
欧拉大学有
这其中,某些床位是单人间,某些则是双人间;同样地,某些座位是单人桌,某些则是双人桌。
我们用一系列数对来表示床位和座位安排。例如,当
新任校监打算调整一下床位和座位安排:他会选择
学生们表示,只有满足以下条件时,他们才愿意进行调整:
- 原本的室友在调整后仍然是室友。
- 原本的同桌在调整后仍然是同桌。
在之前的例子中,只有两种满足上述条件的排列:要么就什么都不做(此时选择的
当
当
而当前的座位安排是
那么在所有的
在文本文件beds.txt和desks.txt中,包含有一组
1,3 2,4
给定这些室友和同桌关系,求满足所有学生条件的排列总数,并将你的答案对
Gitalking ...