This problem is in Contest(s) below:
Contest 1018:贪心算法(提高篇)
Contest 1365:2024秋周五晚c4
Contest 1286:2024春季c++c6