Back to Browse

Coins (AtCoder DP I) | Probability DP Explained | 2D to 1D Space Optimization

362 views
Aug 4, 2025
35:01

In this video, we solve the ๐‚๐จ๐ข๐ง๐ฌ problem from the ๐€๐ญ๐‚๐จ๐๐ž๐ซ ๐„๐๐ฎ๐œ๐š๐ญ๐ข๐จ๐ง๐š๐ฅ ๐ƒ๐ ๐‚๐จ๐ง๐ญ๐ž๐ฌ๐ญ (๐๐ซ๐จ๐›๐ฅ๐ž๐ฆ ๐ˆ).โฃ โฃ This problem explores a unique use-case of ๐ฉ๐ซ๐จ๐›๐š๐›๐ข๐ฅ๐ข๐ญ๐ฒ-๐›๐š๐ฌ๐ž๐ ๐๐ฒ๐ง๐š๐ฆ๐ข๐œ ๐ฉ๐ซ๐จ๐ ๐ซ๐š๐ฆ๐ฆ๐ข๐ง๐ , where we are given the probabilities of getting heads for each coin, and we must calculate the probability of getting more heads than tails after flipping all coins.โฃ โฃ We discuss:โฃ - Why a greedy or brute-force approach failsโฃ - How to build the recursive relation for probability DPโฃ - The bottom-up DP table constructionโฃ - How we optimize space from 2D to 1Dโฃ - And how to use fixed + setprecision(10) for precise answersโฃ โฃ This problem is part of our dynamic programming series that goes from complete beginner to advanced level. Problems are taken from ๐€๐ญ๐‚๐จ๐๐ž๐ซ, ๐‚๐’๐„๐’, ๐‚๐จ๐๐ž๐Ÿ๐จ๐ซ๐œ๐ž๐ฌ, ๐‹๐ž๐ž๐ญ๐‚๐จ๐๐ž, and more.โฃ โฃ Problem link : https://atcoder.jp/contests/dp/tasks/dp_iโฃ โฃ #AtCoderDP #ProbabilityDP #DynamicProgramming #CoinsDP #DPOptimizationโฃ

Download

0 formats

No download links available.

Coins (AtCoder DP I) | Probability DP Explained | 2D to 1D Space Optimization | NatokHD