pritishn's blog

By pritishn, 5 years ago, In English

Problem Link:https://codeforces.net/problemset/problem/442/B

I have been trying to solve it using DP, but there always seems to be precision issues even when using long double.

My submissions : https://codeforces.net/contest/442/submission/81584010

In my approach
dp[i].first = the max probabilty obtainable by choosing 1 or more friends from index i to n-1.
dp[i].second = the product of complements of probablity of all chosen friends.
dp[i].second is helping me do the transition.

Can anyone solve it using such DP without failing due to precision issues?

  • Vote: I like it
  • +1
  • Vote: I do not like it