uva11992 Fast Matrix Operations 线段树打标记

【Bluetooth蓝牙开发】一、开篇词 | 打造全网最详细的Bluetooth开发教程 1、开篇词 2、蓝牙开发入门 3、蓝牙协议栈总览 4、蓝牙协议栈——物理层 5、蓝牙协议栈——链路层 6、蓝牙协议栈——传输层 7、蓝牙协议栈——L2CAP协议 8、蓝牙协议栈——ATT协议 9、蓝牙协议栈——GATT协议 10、蓝牙通信流程分析 11、蓝牙协议栈——Bluez交叉编译 12、蓝牙调试工具汇总 阅读详情

       现在想起来自己好像从来都没有写过线段树lazy tag呢,唉真是惭愧。现在老师开始讲线段树了,我就被要求滚去写线段树啦。。

       这道题就是区间都加上一个值;区间都变为一个值;求区间和,最大值,最小值。其中行数<=20行,所以拆成20个线段树就好了。结果写了两h+(真是弱),然后全局变量pos在main()前面加了个int调了1h+,初始化还写炸了runtime error好几发。。好了不说了。

AC代码如下:

#include<iostream>
#include<cstdio>
#include<cstring>
#define N 500005
#define inf 1000000000
using namespace std;

int n,m,pos; struct node{ int x,y,z; };
int read(){
	int x=0; char ch=getchar();
	while (ch<'0' || ch>'9') ch=getchar();
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return x;
}
struct sgtree{
	int c[N][2],val[N],add[N]; node p[N];
	void clear(){
		memset(val,-1,sizeof(val)); val[1]=0; int i;
		c[1][0]=1; c[1][1]=n;
		for (i=1; c[i][0]; i++){
			if (c[i][0]==c[i][1]) continue;
			int mid=(c[i][0]+c[i][1])>>1;
			c[i<<1][0]=c[i][0]; c[i<<1][1]=mid;
			c[(i<<1)|1][0]=mid+1; c[(i<<1)|1][1]=c[i][1];
		}
	}
	void pushup(int k){
		int ls=k<<1,rs=ls|1,len=c[k][1]-c[k][0]+1;
		if (len>1){
			p[k].x=min(p[ls].x,p[rs].x); p[k].y=max(p[ls].y,p[rs].y);
			p[k].z=p[ls].z+p[rs].z;
		}
		if (val[k]!=-1){ p[k].x=p[k].y=val[k]; p[k].z=val[k]*len; }
		p[k].x+=add[k]; p[k].y+=add[k]; p[k].z+=add[k]*len;
	}
	void pushdown(int k){
		int ls=k<<1,rs=ls|1;
		if (val[k]!=-1){
			val[ls]=val[rs]=val[k]; add[ls]=add[rs]=0; val[k]=-1;
		}
		add[ls]+=add[k]; add[rs]+=add[k]; add[k]=0;
	}
	void ins(int k,int u,int v,int num){
		int l=c[k][0],r=c[k][1],mid=(l+r)>>1;
		if (l==u && r==v){
			if (pos){ val[k]=num; add[k]=0; }else add[k]+=num;
			pushup(k); return;
		}
		pushdown(k);
		if (v<=mid){ ins(k<<1,u,v,num); pushup((k<<1)|1); }else
		if (u>mid){ ins((k<<1)|1,u,v,num); pushup(k<<1); }else{
			ins(k<<1,u,mid,num); ins((k<<1)|1,mid+1,v,num);
		}
		pushup(k);
	}
	node qry(int k,int u,int v,int now){		
		int l=c[k][0],r=c[k][1],mid=(l+r)>>1; node ans;
		if (val[k]!=-1){
			int tmp=val[k]+add[k]+now; ans.x=ans.y=tmp;
			ans.z=tmp*(v-u+1); return ans;
		}
		if (l==u && r==v){
			ans.x=p[k].x+now; ans.y=p[k].y+now;
			ans.z=p[k].z+now*(r-l+1); return ans;
		}
		if (v<=mid) return qry(k<<1,u,v,now+add[k]); else
		if (u>mid) return qry((k<<1)|1,u,v,now+add[k]); else{
			node t1=qry(k<<1,u,mid,now+add[k]),t2=qry((k<<1)|1,mid+1,v,now+add[k]);
			t1.x=min(t1.x,t2.x); t1.y=max(t1.y,t2.y); t1.z+=t2.z; return t1;
		}
	}
}a[21];
int main(){
	while (~scanf("%d%d",&m,&n)){
		int cas=read(),i;
		for (i=1; i<=m; i++) a[i].clear();
		while (cas--){
			pos=read(); int x1=read(),y1=read(),x2=read(),y2=read();
			if (pos<=2){
				pos--; int v=read(); for (i=x1; i<=x2; i++) a[i].ins(1,y1,y2,v);
			}else{
				node ans,t; ans.x=inf; ans.y=-inf; ans.z=0;
				for (i=x1; i<=x2; i++){
					t=a[i].qry(1,y1,y2,0); ans.z+=t.z;
					ans.x=min(ans.x,t.x); ans.y=max(ans.y,t.y);
				}
				printf("%d %d %d\n",ans.z,ans.x,ans.y);
			}
		}
	}
	return 0;
}

by lych

2015.12.19

Vue3 - Vite运行打包时Uncaught ReferenceError: process is not defined(解决vue3+vite报错process is not defined) vue3,vite,vue3+vite报错,process,UncaughtReferenceError:processisnotdefined,浏览器控制台报错processisnotdefined解决方法,vue3如何解决报错,vite报错怎么办,前端打包UncaughtReferenceError:processisnotdefined,npmrunbuild打包报错,vite打包时出现错误,vue3打包运行找不到process,热更新会报错UncaughtRefer 阅读详情

相关推荐

【国民技术N32项目移植】基于 Windows 的 ARM GCC 开发环境

【国民技术N32项目移植】基于 Windows 的 ARM GCC 开发环境

weixin_42150032的博客 1374

UVa 11992 Fast Matrix Operations(两种标记的线段树)

本题涉及到了线段数大多数基本操作。 因为只有20行,所以可以建20个线段树。 线段树最重要的两个函数: pushdown 下移标记,并更新子节点数据。 pushup  由2个子节点数据更新父节点数据。 写法有很多,介绍一种不容易错的: 保证在设置标记的同时更新节点信息。即:在update给某节点打标记,以及pushdown下发标记时,都马上更新节点信息。 这样写的效果是pus

Baoli1008的专栏 550

Palantir解密:“本体”的建模逻辑及其扩展方向

上一篇重点从对现实世界建模的角度探讨了“本体”在数字化架构中的核心意义。这里借Palantir的“本体”概念、解析Palantir只是起点,目标旨在以他山之石攻玉——探索数字世界的底层架构逻辑,最终为构建自主体系提供思考。Palantir以“本体论”为核心的建模方案是否代表终极答案,不宜过早下结论,但其思路值得深入剖析。

SZSDQJC的博客 2650

Uva 11992 Fast Matrix Operations 【线段树】【双标记pushdown】

#include&lt;bits/stdc++.h&gt; using namespace std; #define lson rt &lt;&lt; 1, l, mid #define rson rt &lt;&lt; 1 | 1, mid + 1, r const int MAX = 1e5 + 7; const int INF = 0x3f3f3f3f; struct node{ ...

Head_Hard的博客 250

Mac 不小心断开移动硬盘导致磁盘无法读取和加载(顺利解决!)

Mac移动硬盘不正确断开连接导致无法读取加载的解决方法,亲测有效

Robin_Pi的博客 1万+

在 SAP BTP ABAP 环境里直连 ABAP On-Premise OData

摘要 SAP BTP ABAP Environment 2311版本后,OData集成链路迎来重大改进:Service Consumption Model升级为v2版本,通过压缩模型到单一类减少对象数量;通信管理推荐采用Communication Arrangement替代传统Destination,提供更清晰的治理边界。新版支持同时生成OData v2/v4消费模型,并通过标准工厂类创建代理。配置需关注四层对象:Outbound Service声明协议入口,Scenario定义认证方式,System描述通

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1934

UVA 11992 Fast Matrix Operations(线段树+延迟标记)

这里是对区间的修改,所以需要延迟标记,否则每次修改时间复杂度将会是O(n),会超时。 #include #include #include #include using namespace std; #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define ss(x) scanf("%d",&x) const int maxnode=(1<<17)

qq_33901573的博客 248

巨正则蒙特卡洛—甲烷和二氧化碳的竞争吸附GCMC

巨正则蒙特卡洛—甲烷和二氧化碳的竞争吸附GCMC

Rockyoung 8041

UVA - 11992 Fast Matrix Operations (线段树 + 懒标记)

对于每一个查询和修改x1,x2,y1,y2,我们分别对每一行的线段树处理就行;(3).再考虑打懒标记时要怎么维护?(这个懒标记是没有后效性的!区间变成一个数,区间+一个数,区间查询最值和矩阵和?(1)pushup时这个简单,区间和,区间最值。这个我们看一下数据范围,矩阵最多只有20行;(2).直接考虑pushdown怎么维护?对于每一行开一个线段树,分别维护就行;其实这个题之前写过了《迪拜的超市》那我们就不用二维线段树了;...

qq_53398102的博客 160

【RT-DETR有效改进】利用EMAttention加深网络深度提高模型特征提取能力(特征选择模块)

本文给大家带来的改进机制是EMAttention注意力机制,它的核心思想是,重塑部分通道到批次维度,并将通道维度分组为多个子特征,以保留每个通道的信息并减少计算开销。EMA模块通过编码全局信息来重新校准每个并行分支中的通道权重,并通过跨维度交互来捕获像素级别的关系。本文改进是基于ResNet18、ResNet34、ResNet50、ResNet101,文章中均以提供,本专栏的改进内容全网独一份深度改进RT-DETR非那种无效Neck部分改进,

Snu77的博客 3177

路径规划 | 图解Informed RRT*算法(附ROS C++/Python/Matlab仿真)

Informed RRT*算法针对RRT*算法进行了采样优化,用椭圆采样代替全局均匀采样,避免了RRT*算法搜索树上产生过多冗余分支的缺陷。本文图解Informed RRT*原理,并提供ROS C++/Python/Matlab三种实现加深理解

FRIGIDWINTER的博客 7512

(线段树两个lazy标记需要设定优先级)UVA 11992 - Fast Matrix Operations

题意: 一个n*m的矩阵,最多20行,元素总数量不超过1000000,三种操作,子矩阵+v,子矩阵=v,还有查询子矩阵的(最大值,最小值,和)。 分析: 显然需要懒惰标记,而且需要两个,一个lazy表示赋值的标记,一个add表示增加的标记。 而且需要优先级,显然赋值的优先级比增加高。 因为如果节点上有add,但是这时候lazy的标记push_down下来,显然过去的已经全都作废...

dijieluan7764的博客 177

IO Virtualization with Virtio.part 2 [十三]

通过对virtio_device_id 中的 device 和 vendor 的值进行比较,我们找到对应的 virtio 驱动,由于这里我们使用 i2c virtio 为例,所以调用 virtio_i2c_probe 进行 virtio i2c 设备的初始化。在和 virtio mmio 设备交互时我们会读取 VIRTIO_MMIO_DEVICE_ID 和 VIRTIO_MMIO_VENDOR_ID,并将其值写入 virtio_device_id 中,这个就会用作后面和 virtio 设备驱动的匹配参数。

cxjczy1990的博客 1213

UVA 11992 Fast Matrix Operations

题目链接:UVA 11992 Fast Matrix Operations 分析: 其实这题只用把矩阵完全看成一维的一排数,开一个数组建一个线段树,就行了。然而我却傻傻的每行开了一个线段树,代码有点丑,不要在意。 主要是set操作和Add操作之间的关系要搞清楚。 因为始终是先处理set再处理add,所以set标记传递的时候必须把add标记改为0(代码中有注释),这里很容易忘掉,

INCINCIBLE的博客 499

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

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

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

UVA11992 Fast Matrix Operations

线段树 区间增加+区间覆盖

a free man 631

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Fast Matrix Operations UVA 11992-线段树

这个题属于线段树的一个入门题,对线段树了解之后可以用这个题练一练 题意: 有一个初始状态全为0的矩阵,一共有三个操作 1x1 y1 x2 y2 v:子矩阵(x1,y1,x2,y2)所有元素增加v add 2x1 y1 x2 y2 v:子矩阵(x1,y1,x2,y2)所有元素设为v ...

P19777的博客 222

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

uva11992 Fast Matrix Operations (线段树)

题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18697 题意:给定N*M的矩阵,初始值为0。有三种操作①将x1~x2行的y1~y2列的值加v(v>0)②将x1~x2行的y1~y2列的值改为v(v>0)③查询x1~x2行的y1~y2列里面的所有值的和,以及其中的最小值和最大值。(N 分析:由于N 开始的版

w20810的专栏 505

Uva 11992 Fast Matrix Operations

一堆线段树打标记

我要吃熊猫 382

UVA11992 Fast Matrix Operations 一次开多棵线段树

题目链接 刘汝佳书上的题目,可以把矩形的每一行都开一棵线段树,最多也就20棵,空间也炸不了。然后就是线段树操作了。 注意:下传的时候最大,最小值也要更新。同样注意标记的优先级顺序。 代码如下: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn=4e5+7; ...

weixin_30417487的博客 257

Uva 11992 Fast Matrix Operations(线段树区间设值与加操作)

题目链接Uva 11992 Fast Matrix Operations因为同时有加和赋值操作,所以在下推标记时要注意,应先考虑赋值操作,再考虑加 而在更新的时候如果,是赋值更新,则会清除加标记,而如果是加更新则不会。 wrong了很久才A了。。。。 这里要注意初始值为0,即相当于setv[1] = 0;#include <iostream> #include<cstdio> #includ

taotao 的大学墓志 761

题解 UVA11992 【Fast Matrix Operations】

题目描述 有一个r行c列的全0矩阵,有以下三种操作。 1 X1 Y1 X2 Y2 v 子矩阵(X1,Y1,X2,Y2)的元素加v 2 X1 Y1 X2 Y2 v 子矩阵(X1,Y1,X2,Y2)的元素变为v 3 X1 Y1 X2 Y2 查询子矩阵(X1,Y1,X2,Y2)的和,最大值,最小值 子矩阵(X1,Y1,X2,Y2)满足X1<=X<=X2 Y1<=Y<=Y2的所...

weixin_30527323的博客 102

UVA11992 Fast Matrix Operations(线段树)

题目链接:点击链接题意:给一个矩阵,有三个操作。操作1,将这个矩阵的一个子矩阵的值全加上v。操作2,将这个矩阵的一个子矩阵的值全置为v。操作3,求这个矩阵的一个子矩阵的最大值,最小值,和。思路:看似很简单的set和add操作,我这个线段树菜鸡,卡了很久。前几天写另一道线段树时,突然明白set操作和add操作先后顺序对答案的影响。都明白先add后set,前面的add会被置0,执行Set操作的时候,懒标

酱油拌面 467

uva 11992 Fast Matrix Operations 线段树

代码:

冷月之殇 1916

UVA11992 Fast Matrix Operations 快速矩阵操作(线段树)

题意:对矩阵有三种操作,第一是让矩阵的每个元素加上某个数,第二是让矩阵得每个元素变成某个数,第三是输出某个子矩阵的数字总和,最大值和最小值。开始时,矩阵得每个元素为0. 分析:每行建一颗线段树,多维护几个信息。详见《训练指南》P207-208。 代码: #include<bits/stdc++.h> using namespace std; const int maxnode...

常胜将军的博客 269

Fast Matrix Operations (UVA - 11992,二维线段树 + 简单应用)

一.题目链接: UVA-11992 二.题目大意: 有一个 r × c 大小的矩阵,最多有个元素,r ≤ 20. 矩阵中元素的初始值均为 0. 现有三种操作 ① 1 x1 y1 x2 y2 v :将 (x1, y1) 到 (x2, y2) 之间的元素都加上值 v. ② 2 x1 y1 x2 y2 v:将 (x1, y1) 到 (x2, y2) 之间的元素都置为值 v. ③ 3 ...

The___Flash的博客 259
上一篇: bzoj2142 礼物 组合数学&中国剩余定理
下一篇: bzoj3994 约数个数和 数论&莫比乌斯反演
lych_cys
博客等级 码龄11年 106粉丝 405原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值