I am trying to solve the ASSIGN at SPOJ using DP + Bitmask but getting TLE
Please tell me how to optimize it
Source Code : http://ideone.com/2o9pHa
I am trying to solve the ASSIGN at SPOJ using DP + Bitmask but getting TLE
Please tell me how to optimize it
Source Code : http://ideone.com/2o9pHa
try using a boolean array seen[bitmask] and set that to false for each test case. My solution was almost same as yours except it had a seen array and it passed in ~16 secs