need help in dp problem

Правка en2, от brucewayne123, 2016-06-13 14:44:35

http://mirror.codeforces.com/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..

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский brucewayne123 2016-06-13 14:44:35 2 Tiny change: 'nthanks.. :)' -> 'nthanks.. '
en1 Английский brucewayne123 2016-06-13 14:11:48 603 Initial revision (published)