spoj 375 树链剖分(裸模板)

树链剖分+线段树 之前就学过树链剖分的原理,只会树链剖分LCA,今天做了一道“树链剖分+数据结构”的题,虽然很简单,但可以当模板用一用,粘到这里。树链剖分简单描述(可能不大对): 第一步就是划分轻重边,按每一棵子树的大小,与形成子树最大的一个子节点是重边,其余为轻边,然后就得到了轻重链。 之后就可以用数据结构维护一些东西了,可以是点也可以是边。 对节点 x 到 y 间的路径进行操作时,分别找到 x 和 y 所在链( 阅读详情

看来以后树链剖分要用这个模板了。具体效果怎么样,还要看看,机场wifi太TM慢了。

寒假估计要是有史以来最辛苦的了。寒假疯狂AC万岁。

//树链剖分模板
/*
记siz[v]表示以v为根的子树的节点数,dep[v]表示v的深度(根深度为1),top[v]表示v所在的链的顶端节点,fa[v]表示v的父亲,
son[v]表示与v在同一重链上的v的儿子节点(姑且称为重儿子),w[v]表示v与其父亲节点的连边(姑且称为v的父边)在线段树中的位置。
只要把这些东西求出来,就能用logn的时间完成原问题中的操作。

重儿子:siz[u]为v的子节点中siz值最大的,那么u就是v的重儿子。
轻儿子:v的其它子节点。
重边:点v与其重儿子的连边。
轻边:点v与其轻儿子的连边。
重链:由重边连成的路径。
轻链:轻边。

剖分后的树有如下性质:
性质1:如果(v,u)为轻边,则siz[u] * 2 < siz[v];
性质2:从根到某一点的路径上轻链、重链的个数都不大于logn。
*/
//spoj 375 树链剖分
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#define maxn 100000
using namespace std;
struct Tree
{
	int l, r, _max;
}tree[maxn*4];
struct Eage
{
	int to, next;
}eage[maxn*4];
int son[maxn], fa[maxn], top[maxn], six[maxn],e[maxn],w[maxn],dep[maxn],si[maxn][4];
//son:the son in the same hign chain;fa:the father of node;ro:the first of the chain;
//w:the number of the chain between the fanther and it;si:used to remember the information of the eage.
int n,cnt,z;

void add(int a, int b, int c)
{
	eage[++cnt].to = b;
	eage[cnt].next = e[a];
	e[a] = cnt;
}

void build_tree(int a, int b)              //用来给每个边进行编号(重边要连续),并且确定每个点的祖先节点。
{
	w[a] = ++z;
	top[a] = b;
	if (son[a] != 0)
		build_tree(son[a], b);
	for (int i = e[a];i != -1;i = eage[i].next)
		if (eage[i].to != son[a] && eage[i].to != fa[a])
			build_tree(eage[i].to, eage[i].to);
}

void dfs(int v)
{
	six[v] = 1;son[v] = 0;
	for (int i = e[v];i != -1;i = eage[i].next)
	{
		if (eage[i].to == fa[v])
			continue;
		fa[eage[i].to] = v;
		dep[eage[i].to] = dep[v] + 1;
		dfs(eage[i].to);
		if (six[eage[i].to] > six[son[v]])
			son[v] = eage[i].to;
		six[v] += six[eage[i].to];
    }
}

void update(int a, int l, int r, int m, int v)  //对树链进行编号后的线段树进行初始化
{
	if (l == r)
	{
		tree[a]._max = v;
		return;
	}
	int mid = (l + r) / 2;
	if (m <= mid)
		update(a * 2, l, mid, m, v);
	else
		update(a * 2 + 1, mid + 1, r, m, v);
	tree[a]._max = max(tree[a * 2]._max, tree[a * 2 + 1]._max);
}

void init()
{
	for (int i = 1;i <= maxn * 4;i++)
		tree[i]._max = 0;
	scanf("%d", &n);
	cnt = 0;
	z = 0;
	int root = (1 + n) / 2;
	dep[root] =fa[root]= 0;
	for (int i = 1;i < n;i++)
	{
		scanf("%d%d%d", &si[i][0], &si[i][1], &si[i][2]);
		add(si[i][0], si[i][1], si[i][2]);
		add(si[i][1], si[i][0], si[i][2]);
        }
	dfs(root);
	build_tree(root, root);
	for (int i = 1;i < n;i++)
	{
		if (dep[si[i][0]]>dep[si[i][1]])
			swap(si[i][0], si[i][1]);
		update(1, 1, z, w[si[i][1]], si[i][2]);
        }
}

int maxi(int a, int l, int r, int m, int v)
{
	int ans = 0;
	if ( m<=l&&r <= v)
		return tree[a]._max;
	int mid = (l + r) / 2;
	if (m <= mid)
		ans =max(ans, maxi(a * 2, l, mid, m, v));
	if (v > mid)
		ans =max(ans, maxi(a * 2 + 1, mid + 1, r, m, v));
	//printf("maxi %d %d %d %d %d ans=%d\n", a, l, r, m, v, ans);
	return ans;
}

int query(int a, int b)
{
	int f1 = top[a], f2 = top[b], tmp = 0;
	while (f1 != f2)
	{
		if (dep[f1] < dep[f2])
		{
			swap(f1, f2);
			swap(a, b);
		}
		tmp = max(tmp, maxi(1, 1, z, w[f1], w[a]));
		a = fa[f1];
		f1 = top[a];
	}
	if (a == b)
		return tmp;
	if (dep[a] > dep[b])
		swap(a, b);
	return max(tmp, maxi(1, 1, z, w[son[a]], w[b]));
}

void work()
{
	char ch[20];
	scanf("%s", ch);
	while (ch[0] != 'D')
	{
		int a, b;
		scanf("%d%d", &a, &b);
		if (ch[0] == 'Q')
			printf("%d\n", query(a, b));
		else
			update(1, 1, z, w[si[a][1]], b);
		scanf("%s", ch);
	}
}

int main()
{
	int T;
	//freopen("d:\\in.txt", "r", stdin);
	//freopen("d:\\inn.txt", "w", stdout);
	scanf("%d", &T);
	while (T)
	{
        memset(e, -1, sizeof(e));
		memset(son, 0, sizeof(son));
		memset(top, 0, sizeof(top));
		memset(six, 0, sizeof(six));
		init();
		work();
		T--;
	}
	return 0;
}
徒手敲了一个下午,很好

【电磁场与电磁波课程设计】基于HFSS的双频微带天线仿真及设计 第五代移动通信技术(5G)的商用已经近在眼前,作为移动通信中最为重要的功能组件,面向5G通信应用的手机天线与基站天线的技术研究与设计成为近年来的热点。随着移动通信中“跳频”“扩频”等通信技术发展,为了满足与多个终端的通信要求,实现多系统共用和收发共用等功能,这就要求天线在不同频段下工作。根据国家工信部的最新规定,5G移动通信的中频段被划定在3.3 GHz-3.5 GHz及4.8 GHz-5.0 GH,面向5G移动通信的天线应具有高增益、小型化、宽频段及高隔离度等技术特征,以满足5G通信的高传输速率、波束智能 阅读详情

相关推荐

开源Agent Skill让AI画图不再翻车:从数据到专业图表全流程

在人工智能与数据可视化交叉领域,让模型直接生成图表往往伴随字体乱码、坐标轴密集、配色失调等高频问题。Agent Skill作为一种可复用的能力封装机制,将专业绘图流程固化为标准化操作手册,从数据特征识别、图表类型决策到代码生成与渲染校验形成完整闭环。它不再依赖临时提示词的一次性发挥,而是让AI按领域专家的思维执行任务,显著提升出图质量与稳定性。这种能力在数据分析报告、运营日报、论文插图等场景具有广泛实用价值,尤其适用于需要快速产出规范化图表的工作流。本文即从这一技术范式出发,介绍一个GitHub上获得2.5

weixin_33851429的博客 931

树链剖分模板题【spoj 375】【HDU 3966】【POJ 3237】【poj2763】【bzoj2243】

边权【spoj 375】 #include&lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; const int maxn = 10010; struct Edge{ int to,next; }edge[maxn*2]; int head[maxn],tot; int top[maxn],fa[maxn...

纸箱xyr 214

MediaCodec视频解码流程详解及参考demo

本文主要讲解mediacodec的视频解码流程,及demo参考例子。

分享音视频技术 7872

kyeremal-spoj375-Query on a tree-树链剖分

spoj275-Query on a tree 原题: QTREE - Query on a tree no tags  You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. We will ask

kyeremal的专栏 554

android+音乐节拍检测,科学网—音乐节拍跟踪或音乐节拍检测软件,LilyBeats alpha - 石自强的博文...

我们设计并实现了一种用于实时跟踪音乐节拍的软件。该软件可以用于智能灯方案提供商,为其提供灯光随音乐变化的核心解决方案。首先给出软件的下载链接:或者音乐节拍是乐曲中表示固定单位时值和强弱规律的组织形式,亦称拍子。它有两个特性:周期性和连续性。节拍周期性表现为节拍结构,是乐曲中周期性出现的节奏序列。节拍连续性表现为音乐的平均速度,其单位为bpm(beat per minute每分钟音乐节拍的个数)。音...

weixin_39571403的博客 1400

【2025CSPJ普及组】T4. 多边形

【2025CSPJ普及组】T4. 多边形【题目描述】小 R 喜欢玩小木棍。小 R 有 n 根小木棍,第i(1≤i≤n) 根小木棍的长度为 ai。

lybc2019的博客 849

树链剖分详解及模板

这几天学习了一下树链剖分,顺便写一下我的理解、 早上看了一下别人的讲解,云里雾里,终于算是搞懂了、 树链剖分是解决在树上进行插点问线,插线问点等一系列树上的问题 假如现在给你一棵树,然后没两条边之间有一条权值,有一些操作,1:x---y之间的最大权值是多少,2:改变x---y之间的权值 当前这样的操作有很多,如果直接用暴力的方法的话肯定不行,那么就要想一个好的方法,我们可以想一

大神养成中..... 2万+

组建高效AI开发团队:角色、技能与协作

在当今科技飞速发展的时代,人工智能(AI)已经成为各个领域的核心驱动力。组建高效的AI开发团队对于企业和科研机构来说至关重要,它能够推动创新、提高竞争力、实现业务目标。本文的目的在于为那些希望组建或优化AI开发团队的管理者、技术负责人以及相关从业者提供全面的指导。范围涵盖了团队角色的定义、所需技能的分析、团队协作的策略,以及实际项目中的应用和相关资源的推荐。本文将首先介绍AI开发团队的核心概念与联系,包括团队角色、技能和协作之间的关系。接着阐述核心算法原理和具体操作步骤,结合数学模型和公式进行详细讲解。

2502_91592937的博客 995

【模板】【SPOJ375】树链剖分

【模板】树链剖分->基于边的重编号

sdfzchy的博客 404

PID、模糊PID、SkyHook、LQR、H2/H∞、ADRC等悬架控制合集

PID、模糊PID、SkyHook、LQR、H2/H∞等悬架控制合集

Mr.邹的博客 2013

【WRF湿度调整策略】WRF/ERA5湿度数据对比

【WRF湿度调整策略】WRF/ERA5湿度数据对比

WW、forever的博客 117

SPOJ 375 树链剖分

点击打开链接 题意:给个树和树上的权值,两个操作,Q u v,问u到v的边上的最大权值,C u v,将第u条边的权值改为v 思路:今天学了学树链剖分,这题是个检验模版的题目,理论我是解释不清楚的,自己在九野聚聚那学来的一份模版#include #include #include #include #include #include using namespace std; type

Dan__ge的博客 1617

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

spoj 375 树链剖分 模板

QTREE - Query on a tree #tree You are given a tree (an acyclic undirected connected graph) withNnodes, and edges numbered 1, 2, 3...N-1. We will ask you to perfrom some instructions...

anuancong1219的博客 151

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

【树链剖分模板】【SPOJ 375】 Query on a tree

树链剖分模板~ 【SPOJ 375】 Query on a tree

Regina8023 1536

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

树链剖分

树链剖分的原理简介 考试时遇到的几个树链剖分 数据结构练习T4 SPOJ375 QTREE修铁路 几道树链剖分的练习 BZOJ 1036 ZJOI2008树的统计树链剖分的原理简介

CYCKCN的博客 608

spoj375

题解: 树链剖分的模板题 具体代码详见网上的其他代码 代码: #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespace std; const int N=400005; char s[100]; in...

a5199519的博客 173

树链剖分(spoj375)基于边权

原来以为树链剖分是很高端的数据结构,学习之后才知道,树链剖分思想也不是很难,首先把树分成好多条链,然后结合线段树或者伸展树 SPOJ Problem Set (classical) 375. Query on a tree Problem code: QTREE You are given a tree (an acyclic undirected connected graph)

龙崎的专栏 707

spoj 375. Query on a tree 【树链剖分--插点问线 】

题目:spoj 375. Query on a tree 题意:题意很清晰,就是给你一颗树,每两点之间有权值,然后改变一些权值,问一条路径上的最大值。 分析:入门题目,直接套树链模板 AC代码; #include #include #include #include using namespace std; const int N = 10010; #define

大神养成中..... 2252

spoj 375 树链剖分模板

/* 只是一道树链刨分的入门题,作为模板用。 */ #include #include #include #include #include #include #include using namespace std; #define N 11000 #define inf 0x3fffffff int head[N]; int son[N];//记录与当前点相连的数目最多的子节点的下标 int

晴朗的博客 608

spoj 375 QTREE - Query on a tree 树链剖分边权模板

题目链接:spoj 375 QTREE - Query on a tree #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 so

teddywang 366

spoj375树链剖分模板

题意:     对于一颗树,两种操作(1)修改某边权(2)查询两点间最大边权 解:树链剖分 代码(200ms): #include #include #include #include #include #include #include #define For(i,j,k) for(register int i=(j);i<=(int)k;i++) #define Forr(i,j,k)

ba1_1ad的博客 360

树链剖分边权模板spoj375

树链剖分是树分解成多条链来解决树上两点之间的路径上的问题 如何求出树链:第一次dfs求出树上每个结点的大小和深度和最大的儿子,第二次dfs就能将最大的儿子串起来并hash(映射)到线段树上(或者其他数据结构上),这就是一条重链。 一些性质:1.在树链上进行的算法要额外乘以一个logn:因为找u,v的lca复杂度为O(logn),在找lca的过程中进行其它算法操作,所以算总复杂度时要额外乘上lo...

weixin_30797027的博客 154

SPOJ 375 QTREE POJ 3237 TREE 树链剖分

http://wenku.baidu.com/view/8861df38376baf1ffc4fada8 先上一往篇论文,我总觉得论文说的不够详细,但是可以理解好多东西。 首先,树链剖分就是把树拆成一系列链,然后用数据结构对链进行维护。 通常的剖分方法是轻重链剖分,所谓轻重链就是对于节点u的所有子结点v,size[v]最大的v与u的边是重边,其它边是轻边,其中size[v]是以v为根的子树的

Senbonzakura 1371

SPOJ375——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 : cha

say_c_box的博客 2835
上一篇: Codeforces Round #338 (Div. 2) C. Running Track (dp)
下一篇: hdu 5592 线段树
labrother
博客等级 码龄11年 2粉丝 38原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值