Dynamic Programming21 sections · 916 units
Open in Course

Codeforces 478D Red Green Towers - Problem Statement

Codeforces 478D

You have rr red blocks and gg green blocks. You want to build a tower where level 1 has 1 block, level 2 has 2 blocks, level 3 has 3 blocks, and so on.

Each level must be a single color (all red or all green). How many different towers of maximum possible height can you build? Before reading on, think: why can't dp[i]dp[i] = "ways to build first ii levels" work? What information is missing?