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

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

http://poj.org/problem?id=2385

need help in this problem.I am able to solve the problem by heap.But Unable by Dynamic Programming

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

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

You know, some Chinese symbols and "Peking University" doesn't quite indicate it is Polish Online Judge :p

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

dp[i][j][k] = the maximum number of apples she could eat in the first i minutes, if the she's standing right now under the tree k and so far she has moved j times. You can easily build the dp in a forward manner by going from state (i, j, k) to state (i + 1, j + (k != p), p) with value dp[i][j][k] +(place_where_the_apple_falls[i] == k) where p is the place she'll be at in the (i+1)th minute. k and p only take values 1 and 2, j is up to W (about 30) and i up to N.

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

How did you solve it with a heap?