number of possible permutations in arranging elements

Jun 17, 2018 at 5:45pm
I have a sequence a with length N created by removing some elements (possibly zero) from a permutation of numbers (1,2,…,N). When an element is removed, the length of the sequence doesn't change, but there is an empty spot left where the removed element was. You also have an integer K.

Let's call a permutation p1,p2,…,pN good if:

it is possible replace empty spots in a by numbers in such a way that we obtain the permutation p the number of positions i ( 1 < i ≤ N ) such that pi > pi−1 is equal to K My task is to find the number of good permutations.

Eg n=3 elements k=1 given array (2 ,* ,*) answer=2 explanation:two possible ways (2,3,1) ans (2,1,3)

pls help me derive the formula
Last edited on Jun 17, 2018 at 5:51pm
Jun 17, 2018 at 5:55pm
Can you give a link to a description of this problem written by someone whose first language is English?
Jun 17, 2018 at 5:56pm
https://www.codechef.com/COOK95B/problems/GOODPERM
Topic archived. No new replies allowed.