文章分类 -  acm数据结构-树链剖分

hdu5221 树上区间修改求所有和:树链剖分
摘要:需要注意两个地方:1.修改整棵子树就是节点的size,因为子树映射到线段树上是连续的2.并不是区间修改成一个值,所以预处理出子树的和,然后ok数组判断是否被占领 1 #pragma comment(linker,"/STACK:1024000000,1024000000") 2 #include... 阅读全文

posted @ 2015-05-03 22:09 xiao_xin 阅读(260) 评论(0) 推荐(0)

hdu5052 树链剖分:路径最大收益(烦)
摘要:1 #include 2 #include 3 int cnt,now,a[50005]; 4 int next[100005],head[100005],point[100005]; 5 int num[50005],deep[50005],son[50005],father[5000... 阅读全文

posted @ 2014-10-17 22:28 xiao_xin 阅读(115) 评论(0) 推荐(0)

hdu5029 树链剖分(技巧)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 vectorcol[100005]; 7 int cnt,now; 8 int maxv[400010],ans[100005],maxx[40... 阅读全文

posted @ 2014-10-16 21:19 xiao_xin 阅读(167) 评论(0) 推荐(0)

hdu5044 树链剖分模板(点+边,区间修改)+(附带输入优化和申请栈)
摘要:这是常规的使用线段树超时: 1 #pragma comment(linker, "/STACK:16777216") 2 #include 3 #include 4 long long ans[2][100005]; 5 int next[200005],head[100005],poin... 阅读全文

posted @ 2014-10-02 22:05 xiao_xin 阅读(663) 评论(0) 推荐(0)

spoj375 树链剖分模板(边权,点修改求区间最大值)
摘要:1 #include 2 #include 3 int now,cnt,d[100005][5]; 4 int next[100005],head[100005],point[100005]; 5 int son[100005],father[100005],num[100005],de... 阅读全文

posted @ 2014-10-01 23:41 xiao_xin 阅读(163) 评论(0) 推荐(0)

fuzhou2082 树链剖分模板(边权,修改点查询区间和)
摘要:1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include 3 #include 4 int now,cnt,d[50005][5]; 5 int next[100005],head[50005],point[... 阅读全文

posted @ 2014-10-01 22:52 xiao_xin 阅读(147) 评论(0) 推荐(0)

hdu3966 树链剖分模板(点权,修改区间查询点)
摘要:1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include 3 #include 4 int now,cnt,n,a[50005]; 5 int next[100005],head[50005],point[1... 阅读全文

posted @ 2014-10-01 15:02 xiao_xin 阅读(179) 评论(0) 推荐(0)

导航