
Permutations
You are given a permutation p of numbers 1, 2, …, n. Let’s define f(p) as the following sum: Find the lexicographically m-th permutation of length n in the set of permutations having the maximum possible […]
You are given a permutation p of numbers 1, 2, …, n. Let’s define f(p) as the following sum: Find the lexicographically m-th permutation of length n in the set of permutations having the maximum possible […]
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation […]