This problem is in Contest(s) below:
Contest 1039:csp/noip动态规划专练
Contest 1117:背包专题