This problem is in Contest(s) below:
Contest 1011:栈
Contest 1010:背包问题
Contest 1364:背包问题-Copy