Ski design usaco problem alternative solution
I know, this question is really old, but I will answer it anyway. You can just pick wether you higher the lowest distance or lower the highest one. Then greedy pick the cheaper one until you have your maximum height equal or smaller than 13. In this case, you only need O(max-min-13) steps.  Hope it helps. 

Just keep in mind that you need to track the former changes because of the quadratic equation.