Hint #1
This questions wants you to implement a conventional segment tree. You can use the nyrcs templateHint #2
It wants you to find the minimum instead of the sum. How do you do that?Hint #3
Refer to the slides, the answer is mostly already in the segment tree code section.Fun one ngl
Hint #1: A hint
You can use a sum segment tree creatively to count the number of items in a rangeHint #1a: Answer to hint 1
You can use a segment tree to count the number of things in a range. If there is a thing at position #i, set index #i to 1. If there is no thing, set index #i to 0. Then, range sum in [L, R] to count the number of things within [L, R].Hint #2
Starting from an empty segment tree, is there an order to insert the mountains?Hint #2h: Further hint
We want to insert in an order order which guarantees that all other mountains in the segreee right after insertion are lower than the inserted item.Hint #2a: Answer to hint 2
Insert from lowest to highest.Hint #3: Why am i WA?
Have you remembered to consider what to do if there are multiple mountains of the same height?Hint #3a: Answer to not WA
Insert one of them, evaluate, then remove it. Repeat with all mountains of the same height. Then after evaluating all, you insert all back in.Do you really understand segment tree?
Hint #1
This question needs you to modify the segtree a little. Go understand it’s implementation first then try.Hint #2
You need to modify the segtree such that each segment is not only responsible for storing the max. They now store two pieces of data.Hint #2a: Answer
The segments now need to store both the maximum within their range, and the index of the maximum.Hint #3a: Answer to implement
Change comb to take in pair. What else should change.Hint #3aa Implementation
:) figure it out.💀 Literal math.
Hint #1
This question is literal math.Hint #2
Its math where something somewhere can use a segment tree.Hint #3
The segment tree is used similar to in mountainsNo more hints :) its a challenge.