[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2599 [算法] 点分治 [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 200010 #define MAXK 1000010 typedef long long ll; const ll INF = 2e9; ll i,n,k,u,v,w,tot,root,len,ans; ll head[MAXN]…