#4457. PBDS tree

PBDS tree

当前没有测试数据。

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<
     pair<int,int>,           // key 类型
     null_type,               // mapped 类型(set 用 null_type)
     less<pair<int,int>>,     // 排序规则
     rb_tree_tag,             // 红黑树实现
     // tree_order_statistics_node_update 
     // 支持 order_of_key 和 find_by_order
     tree_order_statistics_node_update> ordered_set; //节点更新策略,这里
// 函数1:返回集合(或树)中第 k(从 0 开始)小的元素的迭代器。
find_by_order(k)
// 函数2:返回集合中严格小于 x 的元素数量。
order_of_key(k)