This problem is in Contest(s) below:
Contest 1448:11,12月初一训练
Contest 1441:YC-NOIP普及
Contest 1112:递归
Contest 1119:递归入门
Contest 1381:暑假背包训练
Contest 1444:Dp入门
Contest 1153:DP入门
Contest 1270:Dp入门及记忆化搜索
Contest 1084:Dp入门
Contest 1421:dfs
Contest 1527:dfs深度优先搜索