There are trees with heights and costs . You start at tree 1 and want to reach tree . From tree , jumping to tree costs . Find the minimum total cost. The cost mixes (source) and (destination).
This product structure is the CHT signal. The problem statement specifies that heights are strictly increasing and costs are strictly decreasing. This ordering is exactly what CHT needs. Let me show you how to set up the DP.