Getting wrong Output

1 COUNT PROBLEM DYNAMIC PROGRAMMING https://ide.codingblocks.com/s/125219
I am getting correct length but I also have to print the array . So How Should I Update It. I have used recursion with memoisation.

for printing make an another array and store 1 if taken otherwise 0