This problem is in Contest(s) below:
Contest 1813:七年级测试
Contest 2105:26夏令营算法提高D——结营测试