report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Permutation counting - MarisaOJ: Marisa Online Judge

Permutation counting

Time limit: 1000 ms
Memory limit: 256 MB
Count the number of permutations of integers from $1$ to $n$ that $|p_i-i| \le m$. ### Input - A single line contains two integers $n,k$. ### Output - Print the number of permutations modulo $10^9+7$. ### Constraints - $1 \le n \le 1000$. - $1 \le k \le 6$. ### Example Input: ``` 4 2 ``` Output: ``` 14 ```
Bitmask DP
Binary board
Travelling Salesman Problem 2
Brewing potion 5
Subsequences counting
Wooden house
Xiangqi
Packing
Permutation counting
Counting tilings
Superstring
Custom keyboard
Mushroom harvesting III
Topic
Dynamic Programming
Bitmasks
Rating 1500
Solution (0) Solution