report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Permutation Counting 2 - FlandreOJ: Flandre Online Judge

Permutation Counting 2

Time limit: 1000 ms
Memory limit: 256 MB
Count the number of permutations $P_1,P_2,...,P_n$ of integers from $1$ to $n$ such that $|P_i - i| \ge X$ for every $i$. ### Input - A single line containing two integers $n$ and $X$. ### Output - Print an integer representing the count of permutations satisfying the conditions, modulo $998244353$. ### Constraints - $1 \le n \le 100$. - $1 \le X \le 5$. ### Example Input: ``` 5 2 ``` Output: ``` 4 ```
Inclusion-exclusion principle
Divisibility
Divisibility 2
Coprime query
GCD pairs counting
Good string pairs
Permutation problem
Restricted equation
Moving through matrix
Restricted equation 2
Binary matrix 2
Permutation Counting 2
Topic
Dynamic Programming
Bitmasks
Rating 2000
Solution (0) Solution