This problem is in Contest(s) below:
Contest 1656:clez提高组练习(贪心、并查集)
Contest 1717:数据结构提升班第三天
Contest 1659:区一中提高组练习(单调队列)
Contest 1794:单调队列单调栈
Contest 1767:普及组(提高)第一天练习