order_statistic.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <ext/pb_ds/assoc_container.hpp> | ||
| 4 | |||
| 5 | template <typename K, typename V, typename Comp = std::less<K>> | ||
| 6 | using order_statistic_map = __gnu_pbds::tree< | ||
| 7 | K, V, Comp, | ||
| 8 | __gnu_pbds::rb_tree_tag, | ||
| 9 | __gnu_pbds::tree_order_statistics_node_update | ||
| 10 | >; | ||
| 11 | |||
| 12 | template <typename K, typename Comp = std::less<K>> | ||
| 13 | using order_statistic_set = order_statistic_map<K, __gnu_pbds::null_type, Comp>; | ||
| 14 | |||
| 15 | // Supports | ||
| 16 | // auto iterator = order_statistic_set().find_by_order(idx); // (0-indexed) | ||
| 17 | // int num_strictly_smaller = order_statistic_set().order_of_key(key); | ||
| 18 |