python doesn't have any library for ordered map and ordered set. We can install sortedContainers module in our pc for that. Please include this module. It would be very helpful for all who code in python.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
python doesn't have any library for ordered map and ordered set. We can install sortedContainers module in our pc for that. Please include this module. It would be very helpful for all who code in python.
Название |
---|
"Just use C++" virgin vs sortedContainers chad
vs Gods who know how to write their own Treap/RB Tree/2-3 Tree/AVL Tree/Scapegoat Tree/Skip List/Any BBST-like data structure
you can also use your own template of sortedlist .. etc
still, the sortedlist template runs in n^(1/3) which is more than the sortedcontainers's sortedlist which runs in nlogn
Just copy the sortedcontainers SortedList source code lol
can you use it directly though? If you could I would think pyrival would already directly copy it without rewriting the whole thing with a higher time complexity
PyRival has a shortened version here. However this version changes .add() to .insert(), .bisect_left() to .lower_bound(), and .bisect_right() to .upper_bound(). I use an older version that retains .add(), .bisect_left(), .upper_bound() and also has the Fenwick tree within the same class, which you may refer here.
Thanks it is better and short
thanks;) huikang
The docs are somewhat confusing in this regard. They say approximate nlogn but then the theoretical bounds are different:
https://grantjenks.com/docs/sortedcontainers/performance-scale.html
That is bullshit. Sortedcontainer's sortedlist runs in O(n^(1/3)) as they explain here.
It doesn't come with the default of any Python implementation, so maybe not.