Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, not as a substitute for the text editorial.
2019A — Max Plus Size
Video
2019B — All Pairs Segments
Video
2019C — Cards Partition
Video
2019D — Speedbreaker
Video
2019E — Tree Pruning
Video
Update: Now Videos are playing. Thank you Shayan for the video tutorial.
Video tutorials are not playing! It shows this error
An error occurred. Please try again later. (Playback ID: dLE5_mB8I9IVhzlN)
Why all downvotes? I think these videos are much better than texts.
I still don't understand how to solve the problem B-All Pairs.
Please help.
You can check out the explanation by ninjacoder2209 in this video, he has explained it very nicely as well. It might give you some more clearity
https://www.youtube.com/watch?v=2M5S9QNetg4
We can derive a formula for each of the points in the array a to find out in how many segments they exist. Now for the numbers between each element of a (if any exist) the formula for how many segments they exist in is slightly different.
Anyhow, once we have the said formula, we can start looping through the array a and in a map store the number of segments the element ai exists in and increment it if any other ai exists the same number of times. For the numbers between ai, we do the same thing.
Once we have this map of segments and the count of numbers that exist in these segments we can loop through queries, see if they exist and then output the answer accordingly.
Here's a python code that breaks it down and I have added comments as well that break down the formula derivation.