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!
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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!
Name |
---|
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.