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

Автор LeCalin, история, 9 лет назад, По-английски

Hello Codeforces .

Plase help.

Given n, array a(a1, a2,,, an). n, a[i] <= 100.

How can i make dp[i][j].

Corectly dp[i][j] = 1, if we can get sum j without a[i].

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

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

How can you say its easy if you are stuck in it and asking for help? :/

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What are the constraints on n ?

If you don't mind, can you put a link to the exact question. This is kind of hard to understand.

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Calculate DP for prefixes and suffixes. Now, DP[i][j] = 1 if there exists A and B such that A+B=j and A is obtained as sum from prefix and B is obtained as sum from suffix.