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

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

So currently, i was doing this problem that say

Given an array,you have to divide this array in to 2 bag,each element belong to 1 bag,find a way to do that the difference of the sum of these 2 bag is minimum.

I had made the observation that the result will not be greater than Max(a[i]),and did some dp and have passed. But i wasn't so sure that my observation is right or i just passed because of luck.

So i want to ask if it right or not.

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

»
5 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

my dp is dp[i][j],meaning if you can create 2 bag from a[1] to a[i] that difference is j