Getting TLE in ASSIGN SPOJ

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

1 Like

@neo1tech9_7 Thanks :slight_smile: It works and passed in 13 seconds.
Learnt a lot.

1 Like