how to do this problem with segment tree data structure. https://www.codechef.com/SEPT17/problems/SEACO
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | nor | 157 |
4 | atcoder_official | 156 |
4 | cry | 156 |
6 | -is-this-fft- | 155 |
7 | maroonrk | 154 |
8 | adamant | 153 |
9 | Um_nik | 151 |
10 | djm03178 | 146 |
how to do this problem with segment tree data structure. https://www.codechef.com/SEPT17/problems/SEACO
Название |
---|
First of all, you need to count how many times a command will be executed. It can done by starting with higher index and work only for type 2.
Secondly, for each command of type 1 perform this command previously calculated times.
Sorry for my bad English.
Almost Same Problem: 295A - Егор и массив
Here time limit is 1.5 sec itna can easly doen in O(qn)
You need to solve this task in O(nlogn) in both problem. You can use seg. tree/bit/difference table
can you share the code
Codechef Problem Code: https://www.codechef.com/viewsolution/17062635
I think it could be solved using prefix sums :D