Given a sequence (1, 2, 3, ... N) and an integer k. You need to find all the permutations of the sequence such that for any i in the permutation |a_i — i| != k↵
↵
[problem link](https://agc005.contest.atcoder.jp/tasks/agc005_d)↵
↵
N <= 2000 and k < n↵
↵
↵
from the given [editorial](https://agc005.contest.atcoder.jp/editorial) i am not able to understand how to find Mk using DP. ↵
Can someone please help. Thank you
↵
[problem link](https://agc005.contest.atcoder.jp/tasks/agc005_d)↵
↵
N <= 2000 and k < n↵
↵
↵
from the given [editorial](https://agc005.contest.atcoder.jp/editorial) i am not able to understand how to find Mk using DP. ↵
Can someone please help. Thank you