dp to represent the glasses, with a size sufficient to cover all rows (100 rows in this case).dp[0][0] to poured as all champagne starts at the top glass.Q that will go to the glasses in the next row if the current glass's flow-through is more than 1 cup.query_glass of the query_row is the minimum of 1 cup and the value in dp[query_row][query_glass].