for this problem UVA 12501
How to solve this problem with segment tree ?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
8 | awoo | 154 |
10 | luogu_official | 150 |
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