This problem is in Contest(s) below:
Contest 1001:YSA程序设计邀请赛
Contest 1070:2022初级算法周日