hdu 3874 树状数组+离线处理

帆软 finereport FCRA 考试 题库+答案,共收录561题,大部分有答案 帆软 finereport FCRA 考试 题库+答案,共收录561题,大部分有答案 入门基础 11.多选题 以下方式中属于FineReport中预览模式的有( ) 分页预览、填报预览、新填报预览、数据分析、移动端预览 16.判断题 FineReport报表工具必须购买激活码后才能使用。 错误,可以免费获取激活码。 29.单选题 FineReport是一款利用( )语言开发的报表工具。java 41.多选题 访问帮助文档的方式有哪些?设计器中社区菜单下-帮助文档;直接访问http://help.finere 阅读详情

题意:

这和hdu 3333 根本就是一道题   链接:http://blog.csdn.net/u013382399/article/details/45689977

思路:

同hdu 3333  

code:

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<cmath>
#include<cstdlib>
using namespace std;

#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mem(a, b) memset(a, b, sizeof(a))
#define mod 1000000007
typedef pair<int,int> pii;
typedef long long LL;
//------------------------------
const int maxn = 50005;
const int maxq = 200005;

struct node{
    int s, e, id;
    bool operator < (const node nt) const{
        if(e != nt.e)
            return e < nt.e;
        else return s < nt.s;
    }
}qujian[maxq];
int n,q;
LL a[maxn];
LL ans[maxq];

struct BIT
{
    long long C[maxn];
    void init()
    {
        memset(C, 0, sizeof(C));
    }
    int lowbit(int x)
    {
        return -x&x;
    }
    long long get_Sum(int x)
    {
        long long ret = 0;
        while(x > 0)
        {
            ret += C[x];
            x -= lowbit(x);
        }
        return ret;
    }
    void add(int x,long long v)
    {
        while(x <= n)
        {
            C[x] += v;
            x += lowbit(x);
        }
    }
}bit;


void init(){
    scanf("%d",&n);
    for(int i = 1; i <= n; i++){
        scanf("%I64d",&a[i]);
    }
    scanf("%d",&q);
    int st, ed;
    for(int i = 0; i < q; i++){
        scanf("%d%d",&st, &ed);
        qujian[i].s = st;
        qujian[i].e = ed;
        qujian[i].id = i;
    }
}
map<long long, int> ma;
void solve(){
    sort(qujian, qujian+q);

//    for(int i = 0; i < q; i++){
//        printf("==%d %d==\n",qujian[i].s, qujian[i].e);
//
//    }


    ma.clear();
    bit.init();
    int start_ = 1;
    for(int i = 0; i < q; i++){
        for(int j = start_; j <= qujian[i].e; j++){
            if(ma.count(a[j])){
                bit.add(ma[a[j]],-a[j]);
            }
            bit.add(j,a[j]);
            ma[a[j]] = j;
        }
        ans[qujian[i].id] = bit.get_Sum(qujian[i].e) - bit.get_Sum(qujian[i].s-1);
        start_ = qujian[i].e + 1;
    }
    for(int i = 0; i < q; i++){
        printf("%I64d\n",ans[i]);
    }
}
int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        init();
        solve();
    }
    return 0;
}

用cin cout 会超时

从 SAP HANA 到 ABAP Cloud:彻底讲透 scalar function 的定位、实现方式与 Clean Core 实践 SAP项目中,scalar function是数据库层的重要计算单元,用于封装可复用的单值逻辑。不同于返回结果集的table function,它直接嵌入SQL表达式,适用于折扣率计算、数据标准化等场景。在SAP技术栈中,scalar function有三种形态:原生SQLScript函数、AMDP托管函数和CDS绑定函数。正确使用可提升查询性能,但需注意与procedure、table function的边界区分。AMDP scalar function是ABAP项目中的推荐实现方式,能确保函数生命周期受 阅读详情

相关推荐

【首份】2023年30米分辨率土地利用遥感监测数据

为了恢复和重建我国土地利用变化的现代过程,更好地预测、预报土地利用变化趋势,地球资源数据云以美国陆地卫星Landsat 遥感影像数据作为主信息源,结合Sentinel系列数据,通过人工目视解译和机器学习方法,建立了国家尺度1:10 万比例尺多时期土地利用/土地覆盖遥感监测数据库(CNLUCC)因早期Landsat数据时空覆盖缺失,1972-1977年合成第一期数据,1978-1985年合成第二期数据,1986年起每年度生成一期数据。投影:Albers正轴等面积双标准纬线圆锥投影南标准纬线:25°N。

地球资源数据云的官方博客 3725

HDU 3874-Necklace【线段树离线】

题意:给你n个数和m个询问,每次询问区间[l, r] 里不相同的数的和。 思路:在线复杂度是略大的,所以考虑离线去做。将区间按右端点排序,然后从左端开始遍历,每次对于之前出现过的节点将之前的节点改为0,然后记录新节点位置并更新,对于之前没有出现过的节点则直接更新就行了。 #include <bits/stdc++.h> using namespace std; typedef l...

独钓门前月 359

光学设计必看:如何用泽尼克系数优化镜头像差?从Zemax到实际案例解析

本文深入解析了如何利用泽尼克系数优化镜头像差,从理解其工程价值、解码软件报告,到在Zemax中主动设置优化目标。通过高倍显微物镜等实际案例,详细展示了如何通过分析泽尼克系数诊断问题,并实施针对性优化策略,从而实现对球差、彗差等像差的精准控制,提升光学设计的精细度和系统稳健性。

gg901的博客 1043

HDU-3874 Necklace(线段树)

Necklace Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4525    Accepted Submission(s): 1550 Problem Description Mery has a beautiful

十分残念的博客 557

告别130MB/s瓶颈!用Zynq+NVMe实现1.2GB/s高速存储的PL数据分流实战

本文详细介绍了如何通过Zynq+NVMe实现1.2GB/s高速存储的PL数据分流方案,突破传统Zynq架构130MB/s的瓶颈。文章分享了PL直连NVMe的硬件架构设计、软件栈优化及性能调优实战技巧,帮助开发者实现高速数据流的稳定存储。

weixin_42653691的博客 373

MLX90640 热成像 STM32

MLX90640 热成像

zhaocundang's blog 5015

hdu3874(离线思想+线段树)

Necklace Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2034    Accepted Submission(s): 733 Problem Description Mery has a beautiful

晓风残月xj 1010

开关电源Y电容的作用、接法与选型指南

Y电容是开关电源EMI滤波电路中的关键安规元件,主要用于抑制共模噪声和提供静电放电防护。其工作原理是通过在初级侧与次级侧之间提供低阻抗回路,将高频噪声引导至地。在工程实践中,Y电容的容值选择需要在EMI抑制效果与漏电流限制之间取得平衡,同时需符合IEC 60384-14等安规标准。常见的应用场景包括反激式开关电源、医疗设备电源等。本文以UC3842反激电源为例,详细解析Y电容的四种经典接法及其适用场景,并提供了基于EMI测试结果的容值计算工程方法。此外,还探讨了选型中常见的五个关键陷阱,如耐压等级误区和温度

weixin_26742753的博客 402

HDU_3874 求连续不重复元素之和(莫队算法/树状数组)

#include&lt;bits/stdc++.h&gt; #define ll long long using namespace std; const int N=50010,M=200010; int n,m,tot; ll a[N],ans[M],C[N]; int vis[N&lt;&lt;5]; typedef struct node{ int l,r,num; void r...

Z_sea的博客 356

【深度学习新浪潮】近三年垂域大模型研究与产品进展全景洞察(2022-2025)

近三年来,垂域大模型完成了从技术探索到产业落地的关键跨越,在多个行业实现效率提升与价值创造。面对数据治理、技术适配、生态建设等挑战,未来需要通过技术创新、标准制定、人才培养等多维度发力,推动垂域大模型向更高效、更可靠、更普惠的方向发展。随着"人工智能+"行动的深入推进,垂域大模型将成为数字经济与实体经济深度融合的核心驱动力,为产业智能化升级注入持续动能。

专注:太空算力、AI infra、异构调度、大模型成本工程 794

基于高德地图的单车路径规划与绘制实战(Vue3 + TypeScript)【拓展:货车路径规划函数、限行检测、城市 Adcode】

✅ 支持单辆车路径规划✅ 自动绘制路线✅ 起点、终点、途经点标注✅ 自动缩放视野至全路径✅ 获取路线距离、时长、过路费✅ 提供清除功能✅ 路线信息保存至本文完整实现了一个基于高德地图 JS SDK + Vue3 + TypeScript的👉单车路径规划与绘制模块。核心亮点:清晰的结构;灵活的扩展性;实时路线信息记录(🚀 你可以很方便地将本模块集成到车联网、调度监控、地图展示类项目中。❤️ 如果这篇文章对你有帮助,别忘了:评论区交流 💬。

专注于前端开发与实战技巧,记录从零到一的学习与项目经验。分享 Vue3 / JavaScript / TypeScript / Flutter /Uniapp等前端技术,以及 性能优化、工程化、最佳实践。 1267

HDU3874 (树状数组+离线操作)

Mery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful value look the same, so if two or more balls have the same b

tystrwor的博客 378

【车载以太网】【SOMEIP】Wireshark测试someip

一、 Wireshark SOMEIP plugin 1.1 插件安装 Wireshark插件目录:Help -> About Wireshark -> Folders/Pluginshttps://github.com/jamores/eth-ws-someip 解压后,将所有后缀是lua的文件拷贝到Wireshark安装目录plugins/2.4.10/下。 1.2时间戳调整为UTC显示格式 View -> Time Display Format -> Date and Tim.

专注汽车软件开发、AutoSAR、车载以太网、SOA、EE架构。 9740

hdu 3874 树状数组 离线处理

hdu 3874 /* 题意:此题的大意思说有一串珠子,每个珠子都有自己的欣赏值value,现在给你一 串珠子每个的欣赏值,并给出一些询问,查询某个区间内部总欣赏值是多少,但是有 一个约定就是如果这个区间内部有两个珠子的欣赏值是一样的,那么他们就视为一个。 其实也就是求某个区间内部不同的数的和。 采用离线操作 离线 通常情况下对一种固定的序列,进行多种不同

xiaohuihui 585

老版QQ原生表情gif动态

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

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

HDU 3874 离线处理,树状数组

题意:查询区间不相同数的集合。 思路:对于每一个查询区间,按照右端点排序,这样我们每次查询的时候,如果这个数在之前出现过,那么的话将前面的删除,重新在新的位置加入。这样每一种数只会被统计一次,查询直接用树状数组进行就行了,相当于前缀和。 #include #include #include #include #include #include #include using namesp

Everything can be done! 267

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

HDU 3874 Necklace(树状数组离线处理)

HDU 3874 Necklace 题目链接 同HDU3333,链接 代码: #include #include #include #include using namespace std; const int N = 50005; const int M = 200005; typedef long long ll; int t, n, a[N]; map g

Remilia's 807

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

HDU 3874 Necklace(树状数组离线处理)

想了一下午没有想到好办法,看了一下别人思路,该题需要离线处理。 这个方法可以很好的处理重复数字的问题,用来求解无重复数字的区间和问题。 将询问的区间按照右端点排序,每次记录上一个区间的右端点R,然后遍历R到当前区间右端点,用一个数组记录每一个数字出现的位置,如果该数字出现过,那么删除上一次出现的位置的值,并更新到当前位置。   这样就可以有效的去重 。   由于整个过程只是遍历了一遍数组,所以

AC_Arthur的专栏 766

HDU 3874 Necklace 树状数组 + 离线处理

/** * 树状数组 + 离线: * 看人题解的,思路: 把询问区间[l, r]存下后按r从小到大排序 * 用数组hash[i]记录数字i最后一次出现的位置。用变量curR从1开始每次 * 往右扫到每个询问区间的r。关键在于没扫到新的一个数的时候,如何更新 * 维护这个树状数组。把每次询问的答案记录到ans数组。 * 具体: 当前数num[curR]如果出现过,则最后一

xuruoxin的专栏 793

HDU 3874 Necklace(树状数组+离线处理)

HDU 3874 Necklace(树状数组+离线处理) 分析: 预处理:首先我们需要一个树状数组A[n],我们从左到右读入所有的a[i],如果当前a[i]=x值是第一次出现,就执行add(i,x),否则不执行.当我们扫描完了n个值后,我们保证sum(R)就是区间[1,R]的答案.(想想是不是)        接下来我们对所有查询的区间进行排序,使得[L,R]区间中L小的区间排在前面.我们首

code 1244

HDU - 3874 Necklace (树状数组、离线处理)

题目链接:Necklace 题意:   给出一串珠子,每个珠子有它的value,现在给出n(n<=5e4)个珠子的value(1<=value<=1e6),现在给出m(1<=m<=2e5)个询问,每个询问给出l和r,要求[l,r]区间内所有珠子的value(如果有相同value值的珠子则只计算一次这个珠子的值)。 题解:   刚开始看到这题,遇到区间...

133

HDU 3874 树状数组 + 离线处理

Necklace Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1529    Accepted Submission(s): 572 Problem Description Mery has a beautiful neck

GentleH's 478

HDU 3874 Necklace (树状数组 | 线段树 的离线处理)

Necklace Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2083    Accepted Submission(s): 747 Problem Description Mery has a beautiful neckla...

weixin_33981932的博客 225

HDU 3874 Necklace (树状数组去重+离线处理)

Problem Description Mery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful value look the same, so if two or more...

邵光亮的博客 410

HDU 3874 Necklace(树状数组+离线处理)

题目大意 有一串长度为 n(1≤n≤50000) 的项链,项链上每块石头都有一个价值,在计算项链上一段连续石头的价值和的时候,相同价值的只计算一次 现在给你 m(1≤m≤200000) 个询问,每个询问要查询一段连续石头 [L, R] (1≤L≤R≤n)的价值和 做法分析 先把所有的查询保存,然后按照查询区间的右端点由小到大排序,然后离线处理: 对于一个具体的石头...

weixin_30662011的博客 99

Necklace HDU - 3874 (线段树/树状数组 + 离线处理)

Necklace HDU - 3874 Mery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful value look the same, so if two or more...

weixin_30832983的博客 143

HDU-3874 Necklace 树状数组+离线处理

这题是要求一段区间内的不重复的数字之和。我们通过对询问区间的右端点进行排序,然后记录每一数字的上一次的出现的位置,由于询问都是不回溯的那么就可以线性的更新了。 代码如下: #include <cstdlib> #include <cstdio> #include <cstring> #include <algorithm> #defi...

weixin_33795833的博客 146
上一篇: hdu 3333 树状数组+离线处理
下一篇: uva 10817 状态压缩DP
GejinZ
博客等级 码龄13年 37粉丝 175原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值