D - Jumping Haybales -线段优化坐标DP

AltiumDesigner.zip 立即下载
  • D - Jumping Haybales

  •  Gym - 101617D 
  • 题意:
  • 从1,1到n, n求最小步数只是每一秒可以向右或向下走k步若是直接搜索无疑会超时
  • 即便是dp也会超时 只有维护k步内最小值直接进行优化即可,
  • 维护方法有多重选择了简单点的线段树
  • 注意线段树的=的位置,Otherwise, it will RE....
  • 不过线段树也在TLE MLE的边缘
  • #include<bits/stdc++.h>
    using namespace std;
    #define maxn 2111
    #define inf 0x3f3f3f3f
    #define ll int
    ll n,tx,ty;
    int k;
    char mmp[maxn][maxn];
    struct node
    {
        ll l,r,num;
    } L[maxn][maxn*4],R[maxn][maxn*4];
    ll dp[maxn][maxn];
    void creat(node *tree,ll l,ll r,ll root)
    {
        tree[root].l=l;
        tree[root].r=r;
        if(l==r)
        {
            tree[root].num=inf;
            return ;
        }
        ll mid=(l+r)/2;
        creat(tree,mid+1,r,root*2+1);
        creat(tree,l,mid,root*2);
        tree[root].num=min(tree[root*2].num,tree[root*2+1].num);
    }
    void updata(node *tree,ll l,ll ad,ll root)
    {
        if(tree[root].l==l&&tree[root].r==l)
        {
            tree[root].num=ad;
            return ;
        }
        ll mid=(tree[root].l+tree[root].r)/2;
        if(l<=mid)
            updata(tree,l,ad,root*2);
        else
            updata(tree,l,ad,root*2+1);
        tree[root].num=min(tree[root*2].num,tree[root*2+1].num);
    }
    ll query(node *tree,ll l,ll r,ll root)
    {
        if(tree[root].l==l&&tree[root].r==r)
            return tree[root].num;
        ll mid=(tree[root].l+tree[root].r)/2;
        if(l>mid)
            return query(tree,l,r,root*2+1);
        else if(mid>=r)
            return query(tree,l,r,root*2);
        else
            return min(query(tree,l,mid,root*2),query(tree,mid+1,r,root*2+1));
    }
    int main()
    {
        ios::sync_with_stdio(false);
        cin>>n>>k;
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
            {
                cin>>mmp[i][j];
                dp[i][j]=inf;
            }
        dp[1][1]=0;
        for(int i=1; i<=n; i++)
        {
            creat(L[i],1,n,1);
            creat(R[i],1,n,1);
        }
        updata(L[1],1,0,1);
        updata(R[1],1,0,1);
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
            {
                if(i==1&&j==1)
                    continue;
                if(mmp[i][j]=='#')continue;
                dp[i][j]=min(dp[i][j],min(query(L[i],max(1,j-k),j,1),query(R[j],max(1,i-k),i,1))+1);
                if(dp[i][j]!=inf)
                {
                    updata(L[i],j,dp[i][j],1);
                    updata(R[j],i,dp[i][j],1);
                }
            }
        if(dp[n][n]==inf)
            cout<<-1<<endl;
        else
            cout<<dp[n][n]<<endl;
        return 0;
    }
    
  •  
  •  
风储VSG-基于虚拟同步发电机的风储并网系统Simulink仿真 内容概要:本文介绍了“Plecs全桥LLC谐振变换器仿真模型”这一技术资源,聚焦于隔离型全桥LLC谐振变换器的建模、仿真与参数设计,涵盖其在电力电子系统中的关键应用,如软启动、闭环控制、变频控制及效率优化等。该模型支持对LLC变换器在不同工作模式下的动态响应与性能表现进行深入研究,适用于探究谐振拓扑结构、磁性元件设计、谐振参数匹配以及先进控制策略的科研与工程实践。同时,文档配套提供了仿真模型、设计报告与计算书等完整资料,强化了其实用性与教学价值。; 适合人群:具备电力电子、自动化或电气工程等相关专业背景,从事电力电子变换器研发、系统仿真与控制算法设计的科研人员、工程师及研究生。; 使用场景及目标:①用于全桥LLC谐振变换器的建模、仿真与动态性能分析;②支持对软启动过程、闭环稳压控制、变频调谐及效率优化等核心技术的研究与教学;③为电力电子电源系统的工程设计、参数优化与控制策略验证提供高精度仿真平台。; 阅读建议:建议结合Plecs或Simulink等仿真工具进行动手实践,重点理解电路拓扑构建、谐振参数计算、控制器设计与系统稳定性分析,并配合文档中的设计报告与计算书,系统掌握从理论到仿真的完整流程。 立即下载

相关推荐

国央企创新负责人如何通过平台实现科技创新资源的系统集成与高效配置?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

Gym - 101617D (Jumping Haybales)

题意:每次只能向右或者向下跳k格以内的格子,"."才能跳,问跳到右下角最少需要几步,如果不能到达输出”-1“。 思路:对每一个”.“,只可能从左边K-1格或者从上面k-1格过来,那么最小步数只要取,这些数据中,最小的步数+1即可。这里求最小,需要用到线段树。 #include #include #include #include #include #define inf 9999999 usi

yz467796454的博客 425

独立储能的现货电能量与调频辅助服务市场出清协调机制(Matlab代码实现)

内容概要:本文介绍了“Plecs全桥LLC谐振变换器仿真模型”这一技术资源,聚焦于全桥LLC谐振变换器在电力电子系统中的建模与仿真研究。该资源提供了基于Plecs平台的高精度仿真模型,完整呈现了变换器的主电路拓扑、谐振参数设计、软开关实现机制及变频控制策略,能够有效支持对系统效率、动态响应与稳态性能的深入分析。模型充分体现了LLC谐振变换器在实现零电压开关(ZVS)、降低开关损耗和提升能量转换效率方面的优势,适用于新能源发电、储能系统及高效率电源设计等应用场景。; 适合人群:具备电力电子、自动控制及电路理论基础知识,从事电力电子变换器设计、新能源系统开发或相关领域研究的研究生、高校教师及工程技术人员。; 使用场景及目标:①用于全桥LLC谐振变换器的工作原理教学与参数设计实践;②支撑软开关特性、变频控制策略、效率优化等关键技术的仿真验证与性能评估;③作为科研项目、课程设计或毕业设计中电力电子系统仿真的核心参考模型,促进理论与工程实践的结合。; 阅读建议:建议使用者在掌握LLC谐振变换器基本工作原理的基础上,结合相关电力电子教材与Plecs软件操作指南,通过调整谐振元件参数、负载条件及控制策略进行多工况仿真,深入理解其工作机理与优化方法,并结合实验数据对比验证仿真结果的准确性。

E - Super Mario HDU - 4417 -主席树第二弹-区间小于K的总数

E - Super Mario  HDU - 4417  lower_bound( 1,n,num):从数组的1位置到n位置二分查找第一个大于或等于num的数字. 找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。 upper_bound( 1,n,num):从数组的1位置到n位置二分查找第一个大于num的数字, 找到返回...

BePosit的博客 871

用Python玩转Carla-Apollo联合仿真:手把手教你实现自动驾驶测试

本文详细介绍了如何使用Python实现Carla-Apollo联合仿真,从环境搭建到自动驾驶算法测试的全流程。通过Carla提供的高逼真仿真环境和Apollo的自动驾驶算法栈,开发者可以高效验证感知、规划和控制模块。文章包含环境配置、Python API操作、桥接实现及实战测试,为自动驾驶开发提供完整解决方案。

wasm7browser的博客 267

深度学习入门:使用CMSIS-NN在微控制器上部署模型的完整指南与Python Jupyter实践

CMSIS-NN是ARM为Cortex-M系列微控制器设计的神经网络库。它旨在提供一套高效、轻量级的神经网络API,使得开发者可以在资源受限的微控制器上运行深度学习模型。CMSIS-NN优化了各种常见的神经网络层,如卷积层、全连接层等,确保它们在微控制器上的运行效率。# 定义模型])# 编译模型# 训练模型这样,我们就得到了一个简单的手写数字识别模型。注意:为了简洁和清晰,本文中的代码可能不是最优的或最完整的实现。为了获得完整的项目和更多的优化技巧,请下载完整项目。

m0_57781768的博客 5884

J - [永不止步-2017]_区间第K大-线段树维护

J - [永不止步-2017]_区间第K大 把线段树的结点的数据域设置为vector类型即可别的操作为区间更新模板 思路就是这样runtime error暂时没改对 #include&lt;bits/stdc++.h&gt; using namespace std; #define inf 0x3f3f3f3f #define maxn 5000000 #define lson roo...

BePosit的博客 470

星链V3的2048条波束与1Tbps:多波束相控阵的工程代价

低轨卫星通信的容量提升,核心在于多波束相控阵天线的空间复用能力。相控阵通过控制大量天线单元的相位,可在同一阵面同时形成多条独立指向的波束,从而在有限频谱内成倍提升系统容量。星链V3宣称的2048条波束与1 Tbps汇聚吞吐量,正是基于这一原理:更多波束意味着更高的频率复用系数和更灵活的资源调度。但工程实现并非免费午餐,数字背后是供电、散热、重量、发射成本及运维复杂度的急剧攀升。从用户侧看,更精细的波束也带来切换频繁、低仰角衰减等新挑战。本文从多波束相控阵的基础原理出发,拆解波束形成、频谱复用和动态调度的工程

weixin_33462167的博客 347

E. Lomsat gelral-CF600E-线段树合并

CF600E 给你一棵有n个点的树,树上每个节点都有一种颜色ci。 让你求每个点子树出现最多的颜色/编号的和 dfs遍历树过程进行线段树(权值线段树)合并,线段树无需按照*2 *2+1的方式去联系父子关系, 可以用一个id 出现一个新的结点id++,这道题注意一下有多个数目相同的颜色时输出他们的和即可。线段树结点维护三个值, 这个点的答案,最多的颜色数目,与颜色种类。 #incl...

BePosit的博客 424

Xilinx XDMA IP核配置实战:AXI Memory Mapped vs Stream选型指南(附PCIe调试技巧)

本文深入解析Xilinx XDMA IP核配置中AXI Memory Mapped与AXI Stream两种DMA接口的核心区别与选型策略。针对PCIe高速数据传输场景,详细对比了二者在数据特性、延迟、硬件资源及软件复杂度上的差异,为FPGA工程师在数据采集、实时处理等项目中做出高效设计决策提供实战指南,并附有关键的PCIe调试技巧。

qsc901234的博客 585

OpenCV轮廓匹配实战:5分钟搞定Hu矩形状识别(附完整代码)

本文详细介绍了使用OpenCV进行轮廓匹配的实战技术,重点讲解了Hu矩形状识别在工业质检等领域的应用。通过完整的代码示例和参数调优技巧,帮助开发者在5分钟内实现高效的形状识别,提升工业检测的准确性和效率。

nnn11的博客 675

G - Balanced Lineup -最值之差

G - Balanced Lineup  POJ - 3264  #include&lt;iostream&gt; #include&lt;stdio.h&gt; #include&lt;cstdio&gt; using namespace std; #define ll long long #define inf 0x7f7f7f7f const int maxn=500050; stru...

BePosit的博客 393

斑马算法优化变分模态分解ZOA-VMD数字信号去噪(优化K值 alpha值)【含Matlab源码 4887期】

斑马算法优化变分模态分解ZOA-VMD数字信号去噪(优化K值 alpha值) 完整的代码,包运行;运行操作视频见优快云资源!适合小白!

订阅付费专栏Matlab(奶茶价版),可赠送奶茶价版付费专栏指定代码1份; 811

C - K-inversions URAL - 1523 -dp-权值树

C - K-inversions  URAL - 1523 题意:给出一个1-n的排列求一下长度为k的  位置与数值满足这个关系的 子序列个数: 1 ≤  i 1 &lt;  i 2 &lt; … &lt;  ik ≤  n and ai 1 &gt;  ai 2 &gt; … &gt;  aik. 思路:dp转移,dp[i][j]    i 代表新的长度为k的序列中第i个数 , j代...

BePosit的博客 388

基于STM32设计的温室大棚种植监测系统(onenet+GPRS通信)

当前所设计的温室大棚种植监测系统基于STM32单片机开发,它能够对温室大棚内的温度、湿度、光照强度、土壤湿度、二氧化碳含量等环境参数进行实时监测,并将数据传输至OneNET云平台,实现了远程监测和管理。该系统具有体积小、功耗低、可靠性高等特点,适合在温室大棚等场合使用。

7873

Winform从入门到精通(21)——ProgressBar(史上最全)

本介绍ProgressBar控件的详细用法,包含所有属性、事件,绝对史上最全!

qq_34059233的博客 3350

P3373 【模板】线段树 +*混合操作

思路:先说一下调了好久的bug而且是易犯得错,注意root.lazy传递给root*2.lazy时不是直接root*2.lazy=root.lazy 而是累计(+或*) 例如:root * 2.lazy + = root.lazy.并且这种+,*混合的要注意只要更新*,就必须更新+,无论是在 updata还是down操作都是只要更新 * 就得更新+. #include&lt;bits/...

BePosit的博客 371

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

A - K-th Number POJ - 2104 -主席树第一弹-第K大的数

感谢:http://www.cnblogs.com/zyf0163/p/4749042.html https://blog.youkuaiyun.com/qq_24451605/article/details/49031123 裸题多次查询给定区间L—R内第K大的数 #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;algori...

BePosit的博客 357

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

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

D - Snacks HDU - DFS序-线段树

D - Snacks  HDU - 5692  注意val值是各个点到0的距离然后dfs序跑一边标号之后建树区间更新区间查询最大值即可 #pragma comment(linker, "/STACK:1024000000,1024000000") #include&lt;iostream&gt; #include&lt;algorithm&gt; #include&lt;cst...

BePosit的博客 355

J-Different Integers-树状数组-区间不同数查询

  https://ac.nowcoder.com/acm/contest/139/J 树状数组学习:https://www.cnblogs.com/acgoto/p/8583952.html 题意:给你一个数组, q次询问, 每次询问都会有1个[l, r] 求 区间[1,l] 和 [r, n] 中 数字的种类是多少。 思路:first数组记录每个值第一次出现的位置,last数组记录每个值...

BePosit的博客 341

K - Master of Sequence HDU - 思维-线段树

K - Master of Sequence  HDU - 6274  给定区间初始状态全部为1,然后有两种操作一种是给某段区间上的数字进行*2另一种是给某段区间上的数字*3 然后最后查询整段区间的GCD,直接线段树维护区间最小值即可有两个维护一个是乘二的次数最小另一个是 乘3的次数最小最后的结果就是2的minsum2次方,3的minsum3次方 #include&lt;s...

BePosit的博客 333

P1972 [SDOI2009]HH的项链-树状数组-区间不同数查询

P1972 [SDOI2009]HH的项链 题意:一个整数N,表示项链的长度。N 个整数,一个整数M,表示 询问的个数。 接下来M 行:每行两个整数,L 和R(1 ≤ L ≤ R ≤ N),表示询问的区间。最终输出区间内不同数目的个数 思路:最初想法:预处理出,到每个位置时已经出现的不同数字的个数,询问按照L排序,然后id从1开始遍历每一段 q[i].L,如果经历过程中遇到的数的终止位置为...

BePosit的博客 315

D - Minimizing maximizer POJ - 1769 -DP-线段树

D - Minimizing maximizer  POJ - 1769  题意:给你一些区间,按照顺序选出最少的区间覆盖 1-n ,如果没有规定按顺序,可以贪心排序 选最少, 思路:按照给定的顺序进行DP转移。可以直接忽略掉dp数组,进行线段树状态的转移,除了 以1开头的区间直接更新最小值,其他的需要查询 当前区间左端点的最小值。然后进行+1 转移 , 转移过程是 更新这个区间...

BePosit的博客 311

L - Vases and Flowers HDU - 4614 -线段树修改

L - Vases and Flowers  HDU - 4614  #include&lt;stdio.h&gt; #define maxn 50150 int ans,st,ed,num; int t,k,n,f,q; struct node { int sum,l,r; int len() { return r-l+1; } ...

BePosit的博客 310

F - Another LIS HDU - 3564 -LIS-线段树

F - Another LIS  HDU - 3564  题意:给你N个数的位置。数字i的位置为a[i],每插一个位置,要求输出当前最大的LIS。 思路:线段树插空法逆序处理出每一个数字所在的位置,然后按照数组去访问,因为题目输入顺序是 1放在哪个位置 2放在那个位置 .....  所以按照1-n去访问这些数数字即可,由于数字是升序访问的,那么他们的位置只要符合单调升的 就是   这...

BePosit的博客 303

F - Count the Colors -小区间为点

F - Count the Colors  ZOJ - 1610  #include&lt;bits/stdc++.h&gt; using namespace std; #define maxn 8888 struct node { int l,r; int color; } tree[maxn*4]; int color[maxn]; int temp,n,a,b,c,an...

BePosit的博客 300
上一篇: A - About Bacteria -换个角度看问题
下一篇: F - Random Sort -思维排列
ID_BePosit
博客等级 码龄9年 76粉丝 647原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值