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

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

I am stuck on this problem

Basically: p1 has N points, p2 has M points. They play N + M - 1 rounds. N, M ≤ 1000. The player who gets zero first loses.

p1 knows the probability of winning each round pi, the loser gets 1 point subtracted.

I can only think of dp in O((N+M)*N*M), but it gets TLE

my code

Any help is appreciated :)

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

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

If I am not mistaken, your O(N*M) dp update is very inefficient? In fact, I believe only O(N+M) element are actually updated? So maybe you can make that more efficient?