zxcv890's blog

By zxcv890, history, 6 years ago, In English

This question was featured in a ICPC Regional Contest. To summarize briefly, it gives a string consisting of 3 possible letters, 'I' (which stands for increasing), 'D' (decreasing) and/or '?' (both 'I' or 'D') to represent two consecutive numbers of an n-permutation (1 to n). Ex. the string 'IID' can fit the 4-permutations {1,3,4,2}, {1,2,4,3} and {2,3,4,1}. The task is given a string, find the number of possible permutations that fit the string in mod 10^9 + 7.

A working solution is found here. Can someone please clarify the recurrence relation to solve this dp?

  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?