一道奇奇怪怪的数据结构题? 把树线性化,然后分块维护吧. 为了加速,求和用树状数组维护每个块的值. #include<bits/stdc++.h> #define N 100010 #define M 320 using namespace std; typedef long long ll; typedef unsigned long long ull; ]; ll c[N],ans[N],val[N]; int cnt,tot,head[N],block,rt,tpos[N],pos[N]…