I have a problem, here is the link: [https://codeforces.me/contest/1602/problem/E](https://codeforces.me/contest/1602/problem/E)↵
The Tutorial showed me a solution using divide and conquer. When i read some accepted code of this problem i realized that most people tend to solve this problem using some data structures like segment tree [like this](https://codeforces.me/contest/1602/submission/133014631) , [or this](https://codeforces.me/contest/1602/submission/133014296) but i can't understand how they solved it with segment tree.↵
I think [this](https://codeforces.me/contest/1602/submission/133014631) is the briefest code i've found, but i can't understand it296) but i can't understand how they solved it with segment tree.↵
Can anyone explain it to me?
The Tutorial showed me a solution using divide and conquer. When i read some accepted code of this problem i realized that most people tend to solve this problem using some data structures like segment tree [like this](https://codeforces.me/contest/1602/submission/133014
I think [this](https://codeforces.me/contest/1602/submission/133014631) is the briefest code i've found, but i can't understand it
Can anyone explain it to me?



