The editorial of this problem Little Elephant and T-Shirts has the recursive version of bitmask dp. Can anyone please help in having the iterative version of bitmask-dp for the same problem.
Did you check solution by tester? It seems to be what you are looking for.
@lebron I had seen the solution of the tester, but didn’t get his dp-state definition. His final answer is dp. If dp[i] is the number of different possible ways to assign the unique t-shirts to ith set of people, then shouldn’t the final answer be dp[(1<<n)-1]?
Thank you [@lebron]. I implemented the code in my way, test cases are running fine, but on submission, it’s producing the wrong answer. Could you please have a quick look at my
? : https://discuss.codechef.com/users/3351/lebron : https://ideone.com/sWiLIK
Just inverse 0 and 1 in mask to get it the way you described.
Also, there is a comment right there in the code describing how does it work and what is it about.
Can anyone help me? why my code is producing the wrong answer.