This problem is in Contest(s) below:
Contest 1062: 032中级-晋级挑战
Contest 1038:CCC Junior 算法基础训练