![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树链剖分
coldfresh
那我们开始吧
展开
-
Query on a tree SPOJ - QTREE(树链剖分)
传送门 题意:给定一棵树,告诉了每条边的权值,然后给出两种操作: (1)把第i条边的权值改为val (2)询问a,b路径上权值最大的边 假期之后的第一篇题解,只学习了一种新的数据结构,树链剖分,此题为入门题,这个我算是学习的最晚的一个人了。这个有种调用了线段的API的感觉#include<cstdio>#include<cstring>#include<algorithm>#inclu原创 2017-10-09 15:48:12 · 315 阅读 · 0 评论 -
Aragorn's Story HDU - 3966(树链剖分)
Our protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who want to invade his kingdom. As Aragorn knows, the enemy has N camps out原创 2017-10-09 23:25:25 · 235 阅读 · 0 评论 -
Minimum spanning tree for each edge CodeForces - 609E(ST算法+树链剖分(或倍增LCA)+最小生成树)
Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains n vertices and m edges.For each edge (u, v) find the minimal possible weight of the spanning tree t...原创 2018-03-21 13:49:34 · 344 阅读 · 0 评论 -
P3384 【模板】树链剖分
题目描述如题,已知一棵包含N个结点的树(连通且无环),每个节点上包含一个数值,需要支持以下操作:操作1: 格式: 1 x y z 表示将树从x到y结点最短路径上所有节点的值都加上z操作2: 格式: 2 x y 表示求树从x到y结点最短路径上所有节点的值之和操作3: 格式: 3 x z 表示将以x为根节点的子树内所有节点值都加上z操作4: 格式: 4 x 表示求以x为根节点的子树内所有节点...原创 2019-04-15 20:28:25 · 139 阅读 · 0 评论