This problem is in Contest(s) below:
Contest 1174:基础课程-计数DP
Contest 1071:长训班动规专题
Contest 1014:NOIP动态规划练习
Contest 1191:2026寒假集训基础强化班