longrange's blog

By longrange, history, 13 months ago, In English

I came across a problem in which I had to find a subset of values which gave me sum N ( N~1e12 ). The value array was hard-coded (by me) and now I am struggling to find a solution to this. The size of array is only 52, but I didn't know how to store boolean values for 'possible' array. I tried bitset, but the size of N is too large.

Could anyone suggest some method?

Tags dp
  • Vote: I like it
  • +8
  • Vote: I do not like it

»
13 months ago, # |
  Vote: I like it +3 Vote: I do not like it

You can solve it using meet-in-the-middle technique