Codeforces 383C Propagating tree(树状数组)

Python 爬虫实战:爬取今日头条文章与阅读量数据 本文详细介绍了基于Python爬取今日头条文章与阅读量数据的完整方案。通过分析今日头条API接口,采用Requests+正则表达式技术实现数据抓取,重点解决加密参数构造、请求头模拟、反爬规避等核心问题。文章包含文章列表获取、详情数据提取、互动数据采集等完整流程,并提供数据存储与基础分析方法。同时强调合规使用爬虫技术,控制爬取频率,避免干扰平台运营。该方案可为内容传播分析、用户兴趣研究提供数据支持,但需注意接口参数更新和反爬机制变化,适时调整代码实现。 阅读详情

参考:http://blog.youkuaiyun.com/accelerator_/article/details/18654307
http://codeforces.com/blog/entry/10476

C. Propagating tree
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value ai. The root of the tree is node 1.

This tree has a special property: when a value val is added to a value of node i, the value -val is added to values of all the children of node i. Note that when you add value -val to a child of node i, you also add -(-val) to all children of the child of node i and so on. Look an example explanation to understand better how it works.

This tree supports two types of queries:

"1 x val" — val is added to the value of node x;
"2 x" — print the current value of node x.

In order to help Iahub understand the tree better, you must answer m queries of the preceding type.
Input

The first line contains two integers n and m (1 ≤ n, m ≤ 200000). The second line contains n integers a1, a2, …, an (1 ≤ ai ≤ 1000). Each of the next n–1 lines contains two integers vi and ui (1 ≤ vi, ui ≤ n), meaning that there is an edge between nodes vi and ui.

Each of the next m lines contains a query in the format described above. It is guaranteed that the following constraints hold for all queries: 1 ≤ x ≤ n, 1 ≤ val ≤ 1000.
Output

For each query of type two (print the value of node x) you must print the answer to the query on a separate line. The queries must be answered in the order given in the input.
Sample test(s)
input

5 5
1 2 1 1 2
1 2
1 3
2 4
2 5
1 2 3
1 1 2
2 1
2 2
2 4

output

3
3
0

Note

The values of the nodes are [1, 2, 1, 1, 2] at the beginning.

Then value 3 is added to node 2. It propagates and value -3 is added to it’s sons, node 4 and node 5. Then it cannot propagate any more. So the values of the nodes are [1, 5, 1,  - 2,  - 1].

Then value 2 is added to node 1. It propagates and value -2 is added to it’s sons, node 2 and node 3. From node 2 it propagates again, adding value 2 to it’s sons, node 4 and node 5. Node 3 has no sons, so it cannot propagate from there. The values of the nodes are [3, 3,  - 1, 0, 1].

You can see all the definitions about the tree at the following link: http://en.wikipedia.org/wiki/Tree_(graph_theory)

题意:n个结点的树,以1为根,可以往结点添加值,添加之后他的子孩子会添加负的该值,直到树的叶子结点为止。有询问和添加值的操作

思路:树状数组,先进行一遍dfs,把每个结点对应的孩子的区间l,r记录下来,然后进行树状数组的区间更新,询问的时候就计算1-l的和,因为这些都为该结点的父亲结点,然后开两个数组,一个作为正一个作为负。

代码:

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define N 200010
#define pii pair<int,int>

int n,m;
int bit[2][N];
void add(int x,int val,int *bit){
    while(x<=2*n){
        bit[x]+=val;
        x+=(x&(-x));
    }
}
int get(int x,int *bit){
    int ret=0;
    while(x){
        ret+=bit[x];
        x-=(x&(-x));
    }
    return ret;
}
struct Node{
    int l,r;
    int tp,value;
}node[N];

int fst[N],vv[N<<1],nxt[N<<1],e;
void add(int u,int v){
    vv[e]=v;nxt[e]=fst[u];fst[u]=e++;
}
int tot;
void dfs(int u,int fa,int d){
    node[u].l=tot++;node[u].tp=d;
    for(int i=fst[u];~i;i=nxt[i]){
        int v=vv[i];
        if(v==fa)continue;
        dfs(v,u,!d);
    }
    node[u].r=tot++;
}
void init(){
    scanf("%d%d",&n,&m);
    tot=1;
    memset(fst,-1,sizeof(fst));e=0;
    for(int i=1;i<=n;++i)scanf("%d",&node[i].value);
    for(int i=1;i<n;++i){
        int u,v;
        scanf("%d%d",&u,&v);
        add(u,v);add(v,u);
    }
    dfs(1,1,0);
    for(int i=1;i<=n;++i){
        printf("%d %d\n",node[i].l,node[i].r);
    }puts("");
}
void solve(){
    for(int i=1;i<=m;++i){
        int op;scanf("%d",&op);
        if(op==1){
            int x,val;scanf("%d%d",&x,&val);
            add(node[x].l,val,bit[node[x].tp]);
            add(node[x].r+1,-val,bit[node[x].tp]);
        }
        else{
            int x;scanf("%d",&x);
            printf("%d\n",node[x].value+get(node[x].l,bit[node[x].tp])-get(node[x].l,bit[!node[x].tp]));
        }
    }
}
int main(){
    //freopen("in.txt","r",stdin);
    init();
    solve();
}
第十四节《OpenCascade集成Qt》 将 OpenCascade 与 Qt 集成是开发图形界面应用的常见需求。通过将 OpenCascade 的几何建模与 Qt 的图形用户界面(GUI)功能结合,可以创建强大而灵活的 CAD 或建模工具。OpenCascade 提供了与 Qt 的集成接口,允许你在 Qt 应用程序中嵌入 OpenCascade 的视图,执行几何操作,并与用户进行交互。以下是 OpenCascade 与 Qt 集成的详细步骤:首先,确保已安装 OpenCascade 和 Qt。你可以从 OpenCascade 官方网站或通过包管理 阅读详情

相关推荐

从‘查理复用’到TM52F1363:深入剖析5脚188数码管的驱动原理与避坑指南

本文深入解析了5脚188数码管的驱动原理,重点介绍了查理复用技术如何通过5个IO引脚高效驱动188段显示,并详细探讨了TM52F1363单片机的寄存器配置与驱动实现。文章还提供了常见问题的解决方案和性能优化技巧,帮助开发者避免实际应用中的各种陷阱。

weixin_29159441的博客 478

Propagating tree 【CodeForces - 383C】【线段树+树链剖分】

题目链接 题意: 有一颗 N 个节点的树,树根编号为 1。 树的每个节点有一个权值 A_i,树上有 N-1 条边 (u_i, v_i)。 现在,你要对这棵树进行 Q 次 下列操作之一。 操作1:选定一个节点 x,将其权值加上 val,将其儿子的权值减去 val,将其儿子的儿子的权值加上 val … 加减操作会在叶节点完成后终止。 操作2:询问节点 x 的点权。 思路: 既然有这样的更...

既然弱小,就只顾变强就是了 347

测站坐标系统 -- 东北天(ENU)坐标系、站心坐标系

测站坐标系统以观测站(或地面上某一个观测点为中心建立坐标系统,将这类坐标系称为测站坐标系统。测站坐标系通常以用户所在的位置点P为坐标原点三个坐标轴分别是相互垂直的东向北向和天向,因而测站坐标系又称为东北天(ENU)坐标系。由于测站坐标系以站心为坐标原点,因此也称为站心坐标系。如图所示,测站坐标系的天向与大地坐标系(LLA经纬度坐标系)在此点的高程方向一致。测站坐标系固定在地球上,本质上是一种地固坐标系。(1)以站心为坐标原点。(2)Z轴与站心点的椭球法线重合,向上为正。

qq_43381998的博客 1万+

CodeForces - 383 C. Propagating tree(dfs序+线段树/树状数组)

题意: 有n个结点,标为1~n,,形成了一棵以1为根节点的树,有m个操作,, 操作有两种: 1。某个节点的值加上v,该节点的隔代都加上v,,该节点的子代以及子代的隔代都减去v。 2。查询某个节点的值。 n,m 如果修改节点值直接暴力dfs的话,时间复杂度为O(n*m),显然超时。 可以看出,修改操作,其实是修改两个区间的值,,,那么可以想到线段树区间修改,lazy一下时间就可以优化到

exp1ore的博客 448

【微服务】SpringBoot 对接飞书审批流程使用详解

SpringBoot 对接飞书审批流程使用详解

congge_study的博客 3770

【打卡帖】7日玩转ESP32——(第4日) 串口的输入输出

【福利帖】7日玩转ESP32——(第4日) 串口的输入输出

1376

Propagating tree CodeForces - 384E

点击打开链接 思维水题 每个区间维护两个值 一个是来自偶数层节点的累加值 另一个是来自奇数层节点的累加值 因为是单点查询 pushup和pushdown都扔掉就 一路加到底即可 #include &lt;bits/stdc++.h&gt; using namespace std; struct node1 { int v; int next; }; struct nod...

sunyutian1998的博客 304

R语言中如何获取前向选择(forward selection)选出的变量

前向选择是一种常用的特征选择方法,可以在给定一个预测模型的情况下,逐步添加变量来确定最佳的预测模型。在R语言中,可以使用适当的函数和库来执行前向选择,并获取选出的变量。以下是一个详细的步骤,展示了如何使用R语言执行前向选择并获得选出的变量。通过按照上述步骤,你可以使用R语言执行前向选择,并获取选出的变量。记住,前向选择是一种特征选择方法,可以根据不同的评估指标选择最佳的预测模型。接下来,准备用于前向选择的数据。使用"summary"函数查看前向选择的摘要,并使用"which"函数获取被选中的变量。

WangWEel的博客 924

CodeForces 383C

题目大意:        liangg

LHYL 3598

YOLOv8与UNetV2融合:一种面向目标检测与图像分割的混合方法【附核心代码】

我们提出了一种基于YOLOv8和UNetV2相结合的混合架构。该架构利用YOLOv8作为主干进行目标检测,同时在YOLOv8的特征提取过程中,引入UNetV2来进行图像分割任务的增强。在该架构中,YOLOv8负责大范围目标检测和位置预测,而UNetV2则在检测网络的特征图基础上,通过其高效的上下文信息提取和细节恢复能力,进一步优化分割任务。在本文中,我们提出了一种改进YOLOv8的方法,通过引入图像分割网络UNetV2来提高图像分割检测性能。

一键难忘的博客 3524

ansys 求解过程中出现未知错误。检查“求解信息”对象上的“求解器输出”,查找可能的原因。-静力学分析遇到的,这是什么原因——An unknown error occurred ——未找到解决方法

点击“确定”关闭弹窗后,进入Workbench的‌“求解信息”对象‌,查看‌“求解器输出”‌,搜索“Error”“Fatal”“Warning”等关键词,找到具体的错误描述,比如材料未定义、网格质量问题、内存不足等,这是精准解决问题的关键。进入“工具-选项-mechanical APDL”,取消勾选“分布式”,GPU加速器选择“none”。在“求解进程设置-高级”中调整内存分配参数,或切换为迭代求解器(如PCG求解器),它更省内存。尝试简化模型,比如删除非关键细节、合并重复部件,分步验证模型,定位问题源。

qq_15963745的博客 603

【树状数组】C. Propagating tree(树上树状数组)

【树状数组】C. Propagating tree(树上树状数组) 咕咕

weixin_45722843的博客 338

PMP--二模--解题--161-170

A:邀请团队成员在下一次回顾中分享经验。B:请求发起人增加具有所需经验的团队成员。C:在团队内计划知识共享会议。D:请求发起人为团队提供培训课程。A。

stqer的博客 1268

Codeforces 383C Propagating tree(树状数组)

题目链接:Codeforces 383C Propagating tree 题目大意:给出一颗有n个节点并一1为根节点的树,每个节点有它的权值,现在进行m次操作,操作分为添加和查询,当一个节点的权值添加val,则它的孩子节点的权值要添加-b。 解题思路:首先通过dfs将树抽象成树状数组,然后以和根节点的层数关系作为d,开两个树状数组分别计算添加值和减少值。 #incl

不慌不忙、不急不躁 2314

深度学习工具包 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")

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Codeforces 383C . Propagating tree【树状数组,dfs】

题目大意: 有一棵树,对这个树有两种操作:1:表示为(1 x val),在编号为x的节点上加上val,然后给x节点的每个儿子加上- val,再给每个儿子的儿子加上-(- val),一直加到没有儿子为止。2:表示为(2 x)查询x节点上的值。 做法: 由于每次修改操作修改的并不是一个值,而是很多值,那我们将该题抽象成区间修改,点查询的问题。那怎么抽象呢?可以明白的是,每次操作虽然有加有减,但是

... 1337

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

CodeForces 383C Propagating tree 树上哈希+树状数组

点击打开链接链接 C. Propagating tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Iahub likes trees very mu

。 672

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Codeforces383 C. Propagating tree(dfs序线段树)

Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value ai. The root of the tree is node 1. This tree has a special property: whe

tomjobs的博客 783

【CodeForces - 383C 】【 Propagating tree】

题目: Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node ihaving an initial value ai. The root ...

哇哈哈哈的博客 335

Codeforces 383C Propagating tree DFS序+BIT

一颗以1为根节点的树,两种操作,1 x c 将节点x值+c,节点x的所有孩子的值-c,所有孩子的孩子的节点+c...交替正负直到叶子节点;2 x 查询节点x当前的值。挺简单的一题..当时怎么就没去看...这题只要能想到时间戳的话,就简单了..首先dfs遍历树打上时间戳,这样每个节点保存一个区间l,r表示访问到该节点到遍历完其子树的区间.每个节点按其到根节点的距离的奇偶性分类,ct[i]=0,1表示

Broken Wings 821

CodeForces 383C :Propagating tree 树状树组 + 差分

传送门 题意 分析 这道题很巧妙啊 首先因为要对整个子树做操作,所以很容易想到可能会跟dfsdfsdfs序有关 但是仔细看一下,这里的modifymodifymodify又跟节点深度奇偶有关,怎么处理呢 我们维护两个树状数组,一个表示深度为奇,一个表示偶,这样,我们在进行modifymodifymodify操作的时候,只需要对对应奇偶的树状数组进行查分操作即可,在查询中,减去奇偶属性相反的和即可 代码 #pragma GCC optimize(3) #include <bits/stdc++.h&g

tlyzxc的博客 527

Codeforces Round #225 (Div. 1) C. Propagating tree dfs序+ 树状数组或线段树

C. Propagating tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/383/problem/C Description Iahub likes trees very much. Recently he discovered an interesting tree named...

weixin_30561177的博客 151

Codeforces Round #225 (Div. 1) C. Propagating tree dfs序+树状数组

C. Propagating tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/383/problem/C Description Iahub likes trees very much. Recently he discovered an interesting tree...

weixin_30517001的博客 117

Codeforces 383C . Propagating tree【树阵,dfs】

标题效果: 有一棵树,有两种操作模式对本树:1:表示为(1 x val),在NOx加在节点上val,然后x每个节点加上儿子- val。给每个儿子一个儿子在一起-(- val),加到没有儿子为止。2:表示为(2 x)查询x节点上的值。 做法: 因为每次改动操作改动的并非一个值,而是非常多值。那我们将该题抽象成区间改动,点查询的问题。那怎么抽象呢?能够明确的是,每次操作尽管有加有减,可是...

weixin_30802171的博客 83

Codeforces Round #225 (Div. 1) C-Propagating tree (DFS序+线段树/树状数组)

题目链接:http://codeforces.com/contest/383/problem/C Description Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes nu

不会吃鱼的喵 675
上一篇: CF:Problem 383D - Antimatter 分治DP
下一篇: Codeforces Round #225 (Div. 1) B 模拟:
sega_handsome
博客等级 码龄10年 7粉丝 164原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值