数据结构-树链剖分
Mitsuha_
Rush to the dead summer
展开
-
ACM-ICPC 2018 焦作赛区网络预赛-E:Jiu Yuan Wants to Eat(树链剖分)
You ye Jiu yuan is the daughter of the Great GOD Emancipator. And when she becomes an adult, she will be queen of Tusikur, so she wanted to travel the world while she was still young. In a country, sh...原创 2018-09-17 11:42:05 · 289 阅读 · 0 评论 -
Wannafly挑战赛21-E:未来城市规划(树链剖分)
链接:https://www.nowcoder.com/acm/contest/159/E时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 乐乐做了个梦,梦见自己当了国王。乐乐王国有N座城市(编号从1~N,首都的编号为1)。乐乐王国的道路构成树状结构:首都1与几个大城市相连,这...原创 2018-08-15 20:19:38 · 409 阅读 · 0 评论 -
hihocoder#1347 : 小h的树上的朋友(树链剖分)
hihocoder#1347 : 小h的树上的朋友(树链剖分)小h拥有n位朋友。每位朋友拥有一个数值Vi代表他与小h的亲密度。亲密度有可能发生变化。岁月流逝,小h的朋友们形成了一种稳定的树状关系。每位朋友恰好对应树上的一个节点。每次小h想请两位朋友一起聚餐,他都必须把连接两位朋友的路径上的所有朋友都一起邀请上。并且聚餐的花费是这条路径上所有朋友的亲密度乘积。小h很苦恼,他需要知道每一次聚餐的花销。小h问小y,小y当然会了,他想考考你。原创 2017-12-23 16:52:39 · 381 阅读 · 0 评论 -
2017年浙江中医药大学大学生程序设计竞赛-A:不存在的树(树链剖分)
2017年浙江中医药大学大学生程序设计竞赛-A:不存在的树(树链剖分)kotomi 有一棵树。树上有n个房子,编号1-n,每个房子有一个快乐值。kotomi想知道从a房子到b房子路径上的最大快乐值或者路径山疙瘩快乐值的和。并且kotomi可以改变任意一个房子的快乐值。具体如下(1) 0 a b:查询a到b路径上的最大快乐值(包含a和b)(2) 1 a b:查询a到b路径上的所有房子快乐值的和。(包含a和b)(3) 2 x y:将编号为x的房子的快乐值改为y。原创 2017-12-20 13:12:56 · 479 阅读 · 0 评论 -
Codeforces-343D:Water Tree(树链剖分)
Codeforces-343D:Water Tree(树链剖分)Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with water.The vertices of the tree are numbered from 1 to n with the root at v原创 2017-11-25 10:09:12 · 465 阅读 · 0 评论 -
FZU - 2082:过路费(树链剖分)
FZU - 2082:过路费(树链剖分)有n座城市,由n-1条路相连通,使得任意两座城市之间可达。每条路有过路费,要交过路费才能通过。每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费。原创 2017-11-24 13:40:47 · 411 阅读 · 0 评论 -
POJ-3237:Tree(树链剖分)
POJ-3237:Tree(树链剖分)You are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbered 1 through N − 1. Each edge is associated with a weight. Then you are to execute a series of instructions on the tree. The instruction原创 2017-11-23 23:04:48 · 345 阅读 · 0 评论 -
SPOJ-tree:Query on a tree (树链剖分)
SPOJ-tree:Query on a tree (树链剖分)You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1.We will ask you to perfrom some instructions of the following form:CHANGE i ti : change the cost of the i-th edg原创 2017-11-23 19:18:59 · 309 阅读 · 0 评论