#include<cstdio> #include<ctime> #include<cstdlib> #include<iostream> #define M 3000009 using namespace std; struct shu { int l,r,sum1,zhi,dui,sum2; }a[M]; int n,root[M],size,ans,b[M],m; void you(int &a1) { int t=a[a1].l; a[a1]…
比较裸的树套树,对于区间K值bz上有一道裸题,详见题解http://www.cnblogs.com/BLADEVIL/p/3455336.html(其实题解也不是很详细) //By BLADEVIL type rec =record left, right, root :longint; end; var n, m :longint; a :..] of longint; t :..] of rec; b_left, b_right, b_key :..] of longint; b_size…
K大数查询 有N个位置,M个操作.操作有两种,每次操作如果是1 a b c的形式表示在第a个位置到第b个位置,每个位置加入一个数c:如果是2 a b c形式,表示询问从第a个位置到第b个位置,第C大的数是多少. N,M<=50000,N,M<=50000 sengxian的题解 一道树套树的题,外层是权值线段树,里层是普通区间线段树. 对于权值线段树的节点 \(u\) 表示权值区间 \([l, r)\),其对应的普通线段树的节点 \(v\) 表示序列\([l_1, r_1)\)中一共有多少个在…