
树链剖分
文章平均质量分 68
Davenny
O ever youthful,O ever weeping.
展开
-
树链剖分模板题-SPOJ QTREE 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 cos原创 2017-07-31 10:40:08 · 353 阅读 · 0 评论 -
CodeForces 343D Water Tree(树链剖分+dfs时间戳)
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原创 2017-08-07 21:17:36 · 548 阅读 · 0 评论 -
BZOJ2243
给定一棵有n个节点的无根树和m个操作,操作有2类: 1、将节点a到节点b路径上所有点都染成颜色c; 2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“ 112221 ” 由3段组成:“ 11 ” 、“ 222 ” 和“ 1 ” 。 请你写一个程序依次完成这m个操作。 Input 第一行包含2个整数n和m,分别表示节点数和操作数; 第二行包含n个正整数表示n个节点原创 2017-08-16 20:35:47 · 556 阅读 · 0 评论 -
uva 12655 Trucks [LCA](树链剖分+MST)
The Subtle Balloons Company (SBC) is the main balloon provider for programming contests; it has huge factories and warehouses, as well as an extensive truck fleet to ensure the contestants’ happiness.原创 2017-08-05 21:07:49 · 489 阅读 · 0 评论