This problem is in Contest(s) below:
Contest 1368:最靓的仔之2
Contest 1125:贪心进阶2
Contest 1027:Noip备战2
Contest 1441:YC-NOIP普及
Contest 1435:栈队列堆