Mathematics (JEE)Very hardCodeforces Div2 D

How many permutations p of {0, 1, 2, 3, 4, 5} satisfy p(i) != i and p(i) != i+1 (addition mod 6) for every i?

  1. A. 265
  2. B. 455
  3. C. 160
  4. D. 80

Correct answer: D. 80

Enumerating the 720 permutations and rejecting any with p(i) equal to i or to i+1 mod 6 for some i leaves 80.

More Permutations, Combinations and Probability questions

Exams that ask this topic