裸题不多说,注意在sqrt(n*log(n))次插入后重构树以保持深度. #include<cstdio> #include<cmath> #include<algorithm> using namespace std; #define N 170011 #define KD 2//ά¶ÈÊý int qp[2][2]; int n,root=1,m; int Begin; bool dn; struct Node { int minn[KD],maxx[KD],p[…
http://www.lydsy.com/JudgeOnline/problem.php?id=3052 题意:n个带颜色的点(m种),q次询问,每次询问x到y的路径上sum{w[次数]*v[颜色]},可以单点修改颜色.(n, m, q<=100000) #include <bits/stdc++.h> using namespace std; const int N=100005, M=100005; typedef long long ll; inline int getint()…