Could anyone from the codeforces community help me solve this problem? Any kind of help will be appreciated. Thankyou in anticipation. https://mirror.codeforces.com/gym/101149/problem/E -> This is the problem link.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Could anyone from the codeforces community help me solve this problem? Any kind of help will be appreciated. Thankyou in anticipation. https://mirror.codeforces.com/gym/101149/problem/E -> This is the problem link.
Название |
---|
You are only allowed to assign scores within the range of each contestant.
You want to maximize the number of contestants with the maximum score.
So consider the result if you decide the maximum score is the max $$$r_i$$$ value at first.
Then try lowering it by one repeatedly and each time consider which contestants can join the group of winners. At a certain point you cannot lower it any further without breaking the scoring conditions of at least one of the contestants.
Generally when working with intervals it can be helpful to view them after sorting them by starting point, end point, size or slack ($$$r_i - l_i$$$).
if possible could you please provide me with the code?
You gain more by implementing yourself. But here it is:
Thankyou!
It is rather easy to solve if you know what dynamic segment tree is. In fact, this is segment tree which supports the same operations as per usual segment tree do, but you can expand value's bounds (in this task you can store all segments from -1e9 to 1e9). If you have such a structure, all you have to do is to add +1 to each number of each segment (using lazy propagation in segment tree) and take maximum over all values in your tree which are bigger than smallest bound of all segments.
P.S. dynamic segment tree usually works like a coordinate compression, but if you're using first way, you should simply copy-paste structure, while in the second way you should "integrate" compression into your code.
if possible could you please provide me with the code?