need help in dp problem

Revision en1, by brucewayne123, 2016-06-13 14:11:48

http://codeforces.me/problemset/problem/543/A hello! i was trying doing this problem in a top down manner.. but i am not able to calculate all the distinct ways.. for example.. if we have v1=1,v2=2,v3-0 then we can add 6 ways to answer by rearranging them but my code adds this just once.. also i am not getting why my recursion is going wrong.. please help me with it.. here is my implementaion without memoising.. https://ideone.com/rUtBD7 i have read the editorial which is explained nicely but it would be nice if someone corrects me in my top down approach.. thanks.. :)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English brucewayne123 2016-06-13 14:44:35 2 Tiny change: 'nthanks.. :)' -> 'nthanks.. '
en1 English brucewayne123 2016-06-13 14:11:48 603 Initial revision (published)