From 6adb7d98bccc23cc8829611ff4b1831708932cd5 Mon Sep 17 00:00:00 2001 From: Yidi Date: Tue, 14 May 2024 17:01:58 +0200 Subject: add missing files --- datastructures/pbds.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 datastructures/pbds.cpp (limited to 'datastructures/pbds.cpp') diff --git a/datastructures/pbds.cpp b/datastructures/pbds.cpp new file mode 100644 index 0000000..c2b44cc --- /dev/null +++ b/datastructures/pbds.cpp @@ -0,0 +1,18 @@ +#include +using namespace __gnu_pbds; +template +using Tree = tree, rb_tree_tag, + tree_order_statistics_node_update>; +// T.order_of_key(x): number of elements strictly less than x +// *T.find_by_order(k): k-th element + +template +struct chash { + const uint64_t C = ll(2e18 * acos(-1)) | 199; // random odd + size_t operator()(T o) const { + return __builtin_bswap64(hash()(o) * C); +}}; +template +using hashMap = gp_hash_table>; +template +using hashSet = gp_hash_table>; -- cgit v1.2.3