This problem is in Contest(s) below:
Contest 1034:课程8
Contest 1047:python练习课程8
Contest 1189:0904练习
Contest 1232:课程8
Contest 1032:2017SSOI