This problem is in Contest(s) below:
Contest 1289:近期测试
Contest 1197:Dp史上大毒瘤