This problem is in Contest(s) below:
Contest 1034:程序设计校内竞赛
Contest 1063:3d