This problem is in Contest(s) below:
Contest 1074:长训班动规高阶专题
Contest 1039:csp/noip动态规划专练