思路:\(k-d\ tree\) 提交:2次 错因:整棵树重构时的严重错误:没有维护父子关系(之前写的是假重构所以没有维护父子关系) 题解: 遇到一个新的点就插进去,如果之前出现过就把权值加上. 代码 #include<cstdio> #include<iostream> #include<algorithm> #define ull unsigned long long #define ll long long #define R register int using…
#include<cstdio> #include<iostream> #include<cstdlib> #include<algorithm> #define M 200009 #define inf 100000000 #define ll long long using namespace std; struct A { ],mx[],d[],v; ll sum; }a[M],b,p[M]; int n,m,root,N,tot; ll lans;…