This problem is in Contest(s) below:
Contest 1169:小P孩的寒假作业
Contest 1084:Dp入门
Contest 1279:dp入门
Contest 1465:Dp入门