首页 > TAG信息列表 > POJ2763

POJ2763 Housewife Wind (树链剖分)

差不多是模板题,不过要注意将边权转化为点权,将边的权值赋给它所连的深度较大的点。 这样操作过后,注意查询ask()的代码有所改变(见代码注释) 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int maxn=100010; 6 int head[m