Hi everyone. I'm having trouble thinking about a dp problem.↵
The problem is:t↵
There are n students with height from 1->n and one number k(n<=2000, k<=n)↵
You have to line up ALL students so that one person in front of the first person and can see exactly k faces. ↵
Example: 2 5 1 6 3 4 => that person can see the face of 1st, 2nd and 4th student.↵
Your work is count how many ways to line up ALL n students. (module 1e9+7)↵
↵
Test↵
Inp: 3 2↵
=> Output 3↵
(2 1 3, 1 3 2, 2 3 1)↵
↵
Thanks for your help.↵
↵
//Ps Sorry, I am not good at English :((
The problem is:t↵
There are n students with height from 1->n and one number k(n<=2000, k<=n)↵
You have to line up ALL students so that one person in front of the first person and can see exactly k faces. ↵
Example: 2 5 1 6 3 4 => that person can see the face of 1st, 2nd and 4th student.↵
Your work is count how many ways to line up ALL n students. (module 1e9+7)↵
↵
Test↵
Inp: 3 2↵
=> Output 3↵
(2 1 3, 1 3 2, 2 3 1)↵
↵
Thanks for your help.↵
↵
//Ps Sorry, I am not good at English :((