vipin_bhardwaj's blog

By vipin_bhardwaj, history, 5 years ago, In English

problem: link

Can someone please help me in this problem, i am not getting how to do this. I think may be it is related to some dp problem or may be graphs. Can you please look into it.

UPD: Contest is already over.
UPD2: pdf link
Thank You

UPD3: Answer

Full text and comments »

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

By vipin_bhardwaj, history, 5 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

Full text and comments »

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