for this problem UVA 12501
How to solve this problem with segment tree ?
# | User | Rating |
---|---|---|
1 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | -is-this-fft- | 165 |
3 | Um_nik | 161 |
3 | atcoder_official | 161 |
5 | djm03178 | 157 |
6 | Dominater069 | 156 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 147 |
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