This problem is in Contest(s) below:
Contest 1044:14级新生周赛(2)
Contest 1116:2015级新生周赛(四)(感谢工大巨巨的友情出题)
Contest 1127:15训练赛3