This problem is in Contest(s) below:
Contest 1019:CSP复赛搜索专题
Contest 1138:2022年暑期普及班-搜索
Contest 1014:NOIP动态规划练习