I wants to do this question with segment tree
i know i can change element in logn time but how i can check there at least on segment available or not according to the que
que link link
plz help
# | 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 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
I wants to do this question with segment tree
i know i can change element in logn time but how i can check there at least on segment available or not according to the que
que link link
plz help
Name |
---|
In the contest, I tried implementing the Segment tree and thought the prefix array won't pass the time constraints, but I was wrong, here is my segment tree AC solution although it can be further optimized.
https://codeforces.net/contest/1843/submission/210506220
Also I didn't quite get wym by " check there at least on segment available " ??
thanks man got it :)
you don't need segment trees for this... its just a basic binary search
Why learning segment trees when you haven't even solved 1300-Rated problems ?
Yeah, In last maybe 20 rounds i dont see a problem(with rating <= 2000), which have solution like "segment tree" or simething more harder. But learning it when you are 1000...
If you're curious, this is a working solution with binary search and prefix sums — no segtree needed, and takes only ~60ms and 1.5MB: 210537397
Why do you learn Segment Tree? Go learn Binary Search.
In fact Binary Search was the expected solution, stop overcomplicating your solutions using hard algorirthms.
If you are interested in the range update method of solving the problem but you need an easy way to do this, I recommend the square root algorithm. It's more suited for beginners, and it is what I used in the contest.