hdu 4819 二维线段树,单点修改区间查询

百度慧眼人口位置数据:从原理到实战的GIS处理全流程 本文详细解析百度慧眼人口位置数据的处理全流程,从基本原理到实战应用。通过空间网格划分、终端数量统计等技术手段,百度慧眼数据能准确反映人群分布特征。文章涵盖坐标系转换、核密度分析、热力图制作等GIS处理技巧,并分享商业选址、城市规划等典型业务场景的解决方案,帮助读者高效利用这一数据资源。 阅读详情


Mosaic

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others)
Total Submission(s): 916    Accepted Submission(s): 402


Problem Description
The God of sheep decides to pixelate some pictures (i.e., change them into pictures with mosaic). Here's how he is gonna make it: for each picture, he divides the picture into n x n cells, where each cell is assigned a color value. Then he chooses a cell, and checks the color values in the L x L region whose center is at this specific cell. Assuming the maximum and minimum color values in the region is A and B respectively, he will replace the color value in the chosen cell with floor((A + B) / 2).

Can you help the God of sheep?
 

Input
The first line contains an integer T (T ≤ 5) indicating the number of test cases. Then T test cases follow.

Each test case begins with an integer n (5 < n < 800). Then the following n rows describe the picture to pixelate, where each row has n integers representing the original color values. The j-th integer in the i-th row is the color value of cell (i, j) of the picture. Color values are nonnegative integers and will not exceed 1,000,000,000 (10^9).

After the description of the picture, there is an integer Q (Q ≤ 100000 (10^5)), indicating the number of mosaics.

Then Q actions follow: the i-th row gives the i-th replacement made by the God of sheep: xi, yi, Li (1 ≤ xi, yi ≤ n, 1 ≤ Li < 10000, Li is odd). This means the God of sheep will change the color value in (xi, yi) (located at row xi and column yi) according to the Li x Li region as described above. For example, an query (2, 3, 3) means changing the color value of the cell at the second row and the third column according to region (1, 2) (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4). Notice that if the region is not entirely inside the picture, only cells that are both in the region and the picture are considered.

Note that the God of sheep will do the replacement one by one in the order given in the input.
 

Output
For each test case, print a line "Case #t:"(without quotes, t means the index of the test case) at the beginning.

For each action, print the new color value of the updated cell.
 

Sample Input
  
1 3 1 2 3 4 5 6 7 8 9 5 2 2 1 3 2 3 1 1 3 1 2 3 2 2 3
 

Sample Output
  
Case #1: 5 6 3 4 6
 

Source
 

Recommend
liuyiding   |   We have carefully selected several similar problems for you:   5201  5200  5199  5198  5197 
 

二维线段树题。

二维线段树有两种,一种是线段树嵌套线段树。第二种是矩形树,将区间分成上下左右两个区间

第一种,常数较小速度比较快写起来也相对没那么长。但是缺点是外层线段树无法懒惰更新(或者是我不会吧?),只能用于区间查询单点更新或者单点查询区间更新。

第二种,常数大速度慢情况比较多,但是能懒惰更新,因为其实还是同一个线段树,只不过二叉变为四叉罢了。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define maxn 801
#define inf 0x3f3f3f3f
int maxi[maxn*3][maxn*3];
int mini[maxn*3][maxn*3];
int a[maxn][maxn];
int n;
int val;  //修改的值
int x, y; //修改点,设为全局变量就不用传到参数里
int x1, x2, y1, y2; //查询的区间
int crx;  //只表示一行的外层线段树节点编号
int cmax, cmin; //记录查询区间的最大值最小值

void buildy(int rx, int ry, int l, int r)
{
  if(l == r){
    if(rx == crx){        //外层线段树只表示一行,l==r,则这个为点,直接赋值
        maxi[rx][ry] = mini[rx][ry] = a[x][l];
    }
    else{                 //外层线段树是一段,则为一列的值,所以由rx(外层)的左子树和右子树更新(也就是同一列的上下区域)
        int lrx = rx<<1, rrx = rx<<1|1;       
        maxi[rx][ry] = max(maxi[lrx][ry], maxi[rrx][ry]);
        mini[rx][ry] = min(mini[lrx][ry], mini[rrx][ry]);
    }
    return;
  }

  int m =(l+r)>>1;
  int lc = ry<<1, rc = ry<<1|1;
  buildy(rx, lc, l, m);
  buildy(rx, rc, m+1,r);
  maxi[rx][ry] = max(maxi[rx][lc], maxi[rx][rc]);
  mini[rx][ry] = min(mini[rx][lc], mini[rx][rc]);
}

void buildx(int rx, int l, int r)
{
  int m = (l+r)>>1;
  if(r > l){
    buildx(rx<<1, l, m);
    buildx(rx<<1|1, m+1,r);
  }
  if(l == r) {crx = rx; x = l;}
  buildy(rx, 1, 1, n);
}

void updatey(int rx, int ry, int l, int r)
{
  if(l == r){
    if(rx == crx)
        maxi[rx][ry] = mini[rx][ry] = val;
    else{
        int lrx = rx<<1, rrx = rx<<1|1;
        maxi[rx][ry] = max(maxi[lrx][ry], maxi[rrx][ry]);
        mini[rx][ry] = min(mini[lrx][ry], mini[rrx][ry]);
    }
    return;
  }

  int m = (l+r)>>1;
  int lc = ry<<1, rc =ry<<1|1;
  if(y <= m)
    updatey(rx, lc, l, m);
  else
    updatey(rx, rc, m+1, r);
  maxi[rx][ry] = max(maxi[rx][lc], maxi[rx][rc]);
  mini[rx][ry] = min(mini[rx][lc], mini[rx][rc]);
}

void updatex(int rx, int l, int r)
{
  int m = (l+r)>>1;
  int lc = rx<<1, rc =rx<<1|1;
  if(r > l){
    if(x <= m)
        updatex(lc, l ,m);
    else
        updatex(rc, m+1, r);
  }
  if(l == r) crx = rx;
  updatey(rx, 1, 1, n);
}

void qy(int rx, int ry, int l, int r)
{
  if(y1 <= l && y2 >= r){
    cmin = min(cmin, mini[rx][ry]);
    cmax = max(cmax, maxi[rx][ry]);
    return;
  }

  int m = (l+r)>>1;
  int lc = ry<<1, rc =ry<<1|1;
  if(y1 <= m)
    qy(rx, lc, l, m);
  if(y2 > m)
    qy(rx, rc, m+1, r);
}

void qx(int rx, int l, int r)
{
  if(x1 <= l && x2 >= r){
    qy(rx, 1, 1, n);
    return;
  }


  int m = (l+r)>>1;
  int lc = rx<<1, rc =rx<<1|1;
  if(x1 <= m)
    qx(lc, l, m);
  if(x2 > m)
    qx(rc, m+1, r);

}

int main()
{
  int t, cnt = 1;
  scanf("%d", &t);
  while(t--){
    memset(maxi, -inf, sizeof(maxi));
    memset(mini, inf, sizeof(mini));
    printf("Case #%d:\n", cnt++);

    scanf("%d", &n);
    buildx(1, 1, n);
    for(int i = 1; i<=n; i++)
      for(int j=1; j<=n; j++)
        scanf("%d", &a[i][j]);
    buildx(1, 1, n);

    int  l;
    int q;
    scanf("%d",&q);
    while(q--){
      scanf("%d%d%d", &x, &y, &l);
      l>>=1;
      x1 = max(1, x-l); x2 = min(n, x+l);
      y1 = max(1, y-l); y2 = min(n, y+l);
      cmax = -inf, cmin = inf; qx(1, 1, n);
      val = (cmin+cmax)>>1;
      printf("%d\n", val);
      crx=-1; updatex(1, 1, n);
    }
  }
}



工作之余的随想:AI 会终结 SAP 顾问吗? 本文是笔者工作之余的一些胡思乱想。昨晚(准确的说是今日凌晨),我又熬了一个夜。没办法,接到一个影响客户项目上线的紧急 incident,花了我好长时间,竟然一点头绪都没有。苦苦思索的过程,时间过得飞快。一转眼就晚上11:30 了。要说我 2007 年还在研三实习期间,就进入了 SAP 行业,到今天已经摸爬滚打 18 年了,按理说也算身经百战了,可以说处理过很多 SAP 客户使用系统时遇到的各种稀奇古怪的问题。但即便这样,我也时常在工作中遇到一开始感到无从下手的问题。 阅读详情

相关推荐

西安电子科技大学841学长经验分享(总成绩第三名)

西安电子科技大学841学长经验分享(总成绩第三名)

qq_30953547的博客 1082

线段树详解(单点修改+区间修改和查询)

【...】 把之前做的线段树的理论总结做了一个整合和一点修改。 线段树不能只是会用板子而已,要理解并且熟练,不假思索分分钟就能敲出来才行。 单点修改+区间修改和查询 例题+代码 目录 【线段树】 【引入】 【概述】 【单点修改和查询】 【建树】 【单点修改】 【区间查询最小值】 【区间查询区间和】 【区间修改和查询】 【延迟标记】 【标记下传】 【标记永久化】 ...

菜鸡成长史 1万+

深度强化学习系列(13): 策略梯度(Policy Gradient)

对于DQN来说使用一个网络直接逼近了值函数,最后取得了非常不错的效果, 但是对于一些连续性控制或者动作空间特别大的环境来说,很难全部计算所有的值函数来得到最好的策略,那么直接计算策略的方法就别提出来了。 回顾一下前面几篇,所谓的策略,其实就是状态到动作的映射数学表达为 π:s→aπ:s→a\pi : s \to a, 我们用ττ\tau 表示状态s到最后一个状态的一个序列,表示为: τ:st...

深度强化学习(DeepRL)探索博客 4642

HDU 4819 —— Mosaic(二维线段树)

题目:http://acm.hdu.edu.cn/showproblem.php?pid=4819

hongrock的专栏 738

【matlab】MATLAB 变量详解与应用

在 MATLAB 中,变量可以通过赋值操作进行定义。例如,要定义一个名为xx = 10;在这个例子中,我们创建了一个名为x的变量,并将其赋值为 10。需要注意的是,MATLAB 是一种动态类型语言,因此不需要显式地声明变量的类型。变量名必须以字母开头。变量名可以包含字母、数字和下划线。变量名区分大小写。不要使用 MATLAB 中的关键字(如forif等)作为变量名。

小吴同学的博客 2211

非目标代谢组学(untargeted metabolomics)中常用的方法学考察的方法(四)

最早使用的一种方法,从QC样本的总离子流图中选择具有代表性的离子峰(覆盖不同的保留时间,不同的强度),在对QC样本进行重复检测之后,计算这些离子的保留时间以及峰面积的相对标准偏差(RSD),用以考察分析方法的稳定性以及重复性。所有样品检测完之后,收集所有的QC样本的原始数据进行数据预处理,包括(峰提取,排列,归一化等),经过数据过滤(80%规则)之后,计算剩下的峰的峰面积的RSD值。由于QC样本是 等量混合了所有的被检测样本,理论上QC样本包含了所有样本中的代谢物,因此QC样本理论上会。

hlllllllhhhhh的博客 1488

HDU---4819:Mosaic【二维线段树】

题意: 给定一个N*N的矩阵,每个格子都有一个数,再给出Q个询问,每次询问以(x,y)为中心的边长为L的正方形矩阵中的最大值和最小值,并修改(x,y)的值为(MAX+MIN)/2 分析: 1)四叉树 对于查询矩阵的最值+修改问题,考虑二维线段树,参照一维线段树的写法:每次将区间二分成两个子区间,对应矩阵应对X,Y同时二分,也就是4个子矩阵,即左上、右上、左下,右下四部分,所以要建一颗四叉树...

KobeDuu 444

【项目解析】2KW 230V 数字逆变器控制系统(二)

【项目解析】 2KW 230V 数字逆变器控制系统(一) 项目的 交流输出电压 并不是单纯一个电压环就能控制好的,而是典型的 双环控制架构:最终占空比控制量会经过计算: 然后写入 单片机 TMM 定时器的比较寄存器 (TMGRA0/TMGRD0/TMGRC1), → 定时器输出互补 PWM, → 驱动 IGBT 全桥, → 经过 LC 滤波形成 230 VAC / 50Hz 的正弦电压。总结交流电压是双环控制的结果:目标/作用:把输出 RMS 电压稳到目标(例如 230 VAC);在母线波动与负载变化下

Naiva的博客 1296

hdu 4819(裸二维线段树)

树套树,这里查询方块的最大值+最小值/2,并在x,y处更新它 #include using namespace std; typedef long long ll; typedef unsigned long long ull; #define clr(x,y) memset(x,y,sizeof x) #define INF 0x3f3f3f3f const int maxn = 800

Everything can be done! 447

产品包装质检实战:基于YOLOv5的智能包装合格检测系统全流程指南

摘要: 针对产品包装质检效率低、漏检率高的问题,本文提出基于YOLOv5的智能检测系统。系统通过采集包装缺陷数据(破损、缺标、封装不良等),利用YOLOv5实现多类别缺陷识别(准确率≥95%),并开发Flask Web界面实现检测可视化与报告生成。实验表明,该系统在30帧/秒的产线速度下可稳定运行,显著提升质检效率。项目涵盖数据标注、模型训练、系统开发全流程,具有工业落地价值,适用于智能制造场景的自动化质检需求。(149字)

LXY_LOVE36的博客 93

手把手教你学simulink(43.2)--光伏发电场景示例:基于Simulink开发一个光伏发电系统仿真模型:采用神经网络控制策略进行优化

需求分析光伏发电系统(Photovoltaic System, PV)是将太阳能转换为电能的重要手段,广泛应用于分布式发电、并网发电和离网供电等领域。随着光伏技术的发展,如何提高光伏发电系统的效率和稳定性成为研究的重点。传统的控制策略(如PID控制器)虽然简单易实现,但在复杂工况下(如光照强度变化、温度波动等)难以达到最优性能。因此,引入先进的控制策略,如神经网络控制(Neural Network Control, NNC),可以显著提升系统的响应速度和鲁棒性。

MHD0815的博客 438

二维线段树——区间最值系列

最近这几天学习了一下二维线段树,二维线段树主要有两种写法,四分树和树套树,暂时还没写过四分树,因为这个东西确实不常用,而且不好写也不好调。 树套树的写法思路其实不难,首先我们知道,我们通常的线段树的操作都是在线段上进行的,即一维的,当推广到二维上,即矩阵时,我们就把它叫做二维线段树。 二维线段树其实就是我们再操作时先找到对应x轴的区间(即第一维),之后再找到对应y轴的区间(即第二维),进行相...

mumei的博客 2854

多 Agent 之间如何通信和协调?OpenClaw 的 Gateway 在其中扮演什么角色?

多 Agent 之间如何通信和协调?OpenClaw 的 Gateway 在其中扮演什么角色?

我哎GIS博客 1665

二维线段树

维护一个矩阵,实现以下几个需求: ①:①:①:单点修改,区间查最值 ②:②:②:区间加,区间查和 ③:③:③:区间修改(递增),区间查最值 二维线段树本质上是树套树 因此无法实现 pushdownpushdownpushdown,用标记永久化替代 暂时无法满足任意模式的区间修改,也可能是我太菜了 注意修改后的 mergemergemerge,只针对所修改区间进行 mergemergemerge 即...

Scar_Halo 2085

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

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

hdoj 4819 Mosaic 【二维线段树 单点更新 区间查询】

题目链接:hdoj 4819 MosaicMosaicTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 1394 Accepted Submission(s): 601Problem Description The God o

世界很大 734

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

HDU 4819:单点更新,区间查询的二维线段树

我越来越觉得之前自己的代码写的就跟shi一样…… 题意很简单,矩阵中指定一个方形

暗黑ZX Cyberwind 763

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

二维线段树(模板)+HDU 4819

好久没有研究数据结构了,今天看到了一个二位ST表的题目,心里突然就想到了二位线段树,于是决定写写,后来发现坑还是很深的……         首先,我们很容易想到的方法是对于二维的,把原本的一维二叉线段树,变成一个二维的四叉线段树。这个的话更容易理解,也貌似很好写很短很漂亮,但是当然了,有很大的缺点就是速度很慢。我试过写了一个发现 HDU 4819 直接tle了,然后非常愤怒的放弃了这种方法,当然可能是我写错了。这里关于这种方式,我给一个链接,这里面配合了很多图片,讲得很好, 点击此处打开链接 但是代码风格和

alpc_qleonardo 970

HDU4819:Mosaic(二维线段树简单模板,树套树,单独修改,区间查询)

二维线段树模板题之一

蒲公英殇的博客 371

HDU 4819 Mosaic(二维线段树)

Mosaic Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 2691    Accepted Submission(s): 1183 Problem Description The God of sheep decides t...

GYH0730的博客 329

HDU 4819 Mosaic(二维线段树单点更新+区间查询+自己的写法模板)

The God of sheep decides to pixelate some pictures (i.e., change them into pictures with mosaic). Here's how he is gonna make it: for each picture, he divides the picture into n x n cells, where each cell is assigned a color value. Then he chooses a cell,

HJY 514

HDU 4819 Mosaic(二维线段树区间查询+单点更新模板)

The God of sheep decides to pixelate some pictures (i.e., change them into pictures with mosaic). Here's how he is gonna make it: for each picture, he divides the picture into n x n cells, where each cell is assigned a color value. Then he chooses a cell,

HJY 700

HDU 4819 Mosaic (二维线段树)

题意:            二维线段树,查询区间最大最小值,修改单点。 思路:            树套树,树和树间各写各的操作,注意conbine(自下而上的结合)和trans(自上而下的连接)即可。 代码: #include using namespace std; #define ls l,mid,rt*2,id #define rs mid+1,r,rt*2+1,id #d

DT2131 408

Hdu4819 Mosaic 二维线段树维护区间最值+单点更新

Mosaic Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 2077    Accepted Submission(s): 927 Problem Description The God of sheep

kyoma的博客 508

树套树-线段树套线段树

线段树套线段树简单应用。

ZigZagK的博客 4825

HDU - 4819Mosaic (二维线段树)

最终板子(单点修改+区间查询最值/矩阵和)别用结构体写了,又乱空间复杂度又高…板子题没啥好说的,维护最值就行。注意线段树开4倍空间!

qq_53398102的博客 202

NOI数据结构:二维线段树

二维线段树专题 二维线段树专题_wangheng-优快云博客_二维线段树 二维线段树 - 英雄哪里出来 - C++博客 UVA 11297 线段树套线段树(二维线段树)_园荐_博客园 浅谈二维线段树 浅谈二维线段树 - TRTTG - 博客园 POJ 2155 Matrix (二维线段树) POJ 2155 Matrix (二维线段树)_每一次AC都是一种感动-优快云博客 [luogu3397]地毯(二维线段树组) [luogu3397]地毯(二维线段树组)_fl_334正

青少年趣味编程 467
上一篇: poj 2887 块状数组/线段树
下一篇: poj 2155 二维树状数组/区间更新单点查询
HuanTongH
博客等级 码龄12年 7粉丝 110原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值