DP

dynamic programming with slope optimization & monotonous queue
Algorithms    Solution / HNOI / DP
dynamic programming with monotonous stack