Hey Everyone, Can anyone tell how to solve the large test case for the problem. Editorial seems a way difficult to understand. If anyone solved that problem, pls help me. Thanks!
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
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 |
Hey Everyone, Can anyone tell how to solve the large test case for the problem. Editorial seems a way difficult to understand. If anyone solved that problem, pls help me. Thanks!
Название |
---|
We will do parallel binary search (if you don't know what this is, you can try finding the blog in codeforces) on the answer K. Now we have update events (value X appears on position i) and query even (what's the maximum value of sum * length of a subinterval between L, R). Both queries can be done in with segment tree. Unfortunately this way the complexity is and will pass for 58 points. But if we use the fast segment tree from Al.Cash's blog it will pass. Furthermore as all values are nonnegative we can actually replace the segment tree with dsu.
For the segment tree you will need the following in each node:
1) Available suffix length and sum.
2) Available prefix length and sum.
3) Answer and length of the whole interval.
This way we can merge the nodes in time.
Ohh Thanks! I am starting to get some intuition for that. Pls share ur code too for more clearity.