This problem is in Contest(s) below:
Contest 1347:NJ信息学编程训练3-21
Contest 1352:2023寒假信息学编程集训5