vipin_bhardwaj's blog

By vipin_bhardwaj, history, 6 years ago, In English

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

N <= 2000 and k < n

from the given editorial i am not able to understand how to find Mk using DP.
Can someone please help. Thank you

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

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by vipin_bhardwaj (previous revision, new revision, compare).

»
6 years ago, # |
  Vote: I like it +4 Vote: I do not like it

gave codesule eh! lolol. coding block sucks when it copies problems from online platforms.