#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define TREE_NODE ll
#define ordered_set tree<TREE_NODE, null_type, less<TREE_NODE>, rb_tree_tag, tree_order_statistics_node_update>
// 중복이 있을 때 less<TREE_NODE> 이면 첫 원소, less_equal<TREE_NODE> 이면 마지막 원소

{
	ordered_set X;
	*X.find_by_order(x);
	X.order_of_key(x);
}

codeforces.com/blog/entry/11080

 

C++ STL: Policy based data structures - Codeforces

 

codeforces.com

gcc.gnu.org/onlinedocs/libstdc++/manual/policy_data_structures_design.html

 

Design

Hash-tables are unfortunately especially susceptible to choice of policies. One of the more complicated aspects of this is that poor combinations of good policies can form a poor container. Following are some considerations. Some combinations do not work w

gcc.gnu.org

 

'알고리즘 > 정리글' 카테고리의 다른 글

Modulo Integer  (0) 2021.04.13
네트워크 플로우  (0) 2021.03.24
그리디  (0) 2021.02.19
기하  (0) 2021.02.19
세그먼트 트리  (0) 2021.01.15

+ Recent posts