pb_ds 一个强大的黑科技


代码

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>

using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;

/// int类型
/// null_type为映射类型, 低版本g++为 null_mapped_type
/// less<int>, greater<int> 比较器
/// rb_tree_tag 和 splay_tree_tag 选择树的类型
/// tree_order_statistics_node_update 结点更新

/// insert, erase
/// order_of_key rank
/// find_by_order() kth  查询的时候要-1
/// lower_bound() 前继, >=x 最小的迭代器
/// upper_bound() 后继   >x  最小的迭代器
/// a.join(b) b并入a,前提是两颗树的取值范围不相交
/// a.split(v, b) key <= v的属于a,其他属于
/// 注意,插入的元素会去重,如set


文章作者: 小凡
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 小凡 !
评论
  目录
隐藏
{% if theme.sakura.enable %}{% endif %}