for this problem UVA 12501
How to solve this problem with segment tree ?
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
for this problem UVA 12501
How to solve this problem with segment tree ?
Name |
---|
something like that. you need to test it, there can be a lot of bugs.
i have not understood your code!!
can you give me the idea to solve the problem ?
all what you need to solve the problem: 1) you need to know how to combine segments. you can find this in my code
2) google "lazy propagation segment tree".
i am not new to segment tree..
I just want to know how to query for this problem. how to combine ? for this interval: [2,5] how to give the ans like this 1*a[2]+2*a[3]+3*a[4]+4*a[5]
btw thanks for the help so far.. :)
let's divide interval [2, 5] into [2, 3] and [4, 5]
1*a[2]+2*a[3]+3*a[4]+4*a[5] = 1*a[2]+2*a[3]+ 2*(a[4]+a[5]) +1*a[4]+2*a[5]
I didn't think of that! Thank you very much for the insight :)
updated code