This problem is in Contest(s) below:
Contest 1030:深度优先搜索(提高篇)