1.如何 O(logn)\mathcal{O(\log{n})}O(logn) 求set中一个数对应的下标(排名),就是lower_bound查找一个数后求出这个数之前的数的个数,在数组中对应lower_bound(a+1,a+n+1,x)-a,想知道在set中如何处理
lower_bound
lower_bound(a+1,a+n+1,x)-a
2.如何 O(logn)\mathcal{O(\log{n})}O(logn) 求pb_ds平衡树中一个数对应排名,只会tr.order_of_key(*tr.lower_bound(mp(x,0))),但是这个的复杂度貌似是 O(log2n)\mathcal{O(\log^2{n})}O(log2n)
tr.order_of_key(*tr.lower_bound(mp(x,0)))