Блог пользователя longrange

Автор longrange, история, 13 месяцев назад, По-английски

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?

Теги dp
  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
13 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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