bzoj3289 树状数组+莫队

从零到一:手把手部署用友T3标准版11.2及SQL Server 2008R2环境 本文详细介绍了从零开始部署用友T3标准版11.2及SQL Server 2008R2环境的完整流程,包括环境准备、SQL Server安装、环境检测与修复、T3标准版安装实战以及初始化配置与测试。通过手把手的步骤指导和常见问题解决方案,帮助用户顺利完成部署,确保系统稳定运行。 阅读详情

这是本蒟蒻的第一篇博客,在此手动庆祝一下~~
其实今天本来想写一道树链剖分的题但是一直没过(蒟蒻的无奈)……所以只好写前几天莫队的题解啦
这道题分为两个知识点,树状数组和莫队
1。莫队 就是最基本的套路啦,分块+离线排序
2。树状数组 我做这道题本来是奔着莫队的,没想最开始还被树状数组坑了
一定要注意分类讨论两点:
1)pl->a[i].l 和pr->a[i].r 的变化会使ans加还是减
2)
pl->a[i].l ,所影响的是增减的数和它后面的数所组成的逆序对,所以查询树状数组最后return x后面的数
pr->a[i].r ,所影响的是增减的数和它前面的数所组成的逆序对,所以查询树状数组最后return x前面的数
代码见下:

/**************************************************************
    Problem: 3289
    User: DD_D
    Language: C++
    Result: Accepted
    Time:5544 ms
    Memory:2400 kb
****************************************************************/

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=50000+5;
int siz[N],val[N],pos[N];
int tree[N],rt[N];
int n,q,sum,ans;
struct data{
    int l,r,id;
}a[N];
int cmp(data a,data b)
{
    if(pos[a.l]==pos[b.l]) return  a.r<b.r;
    return a.l<b.l;
}
int cmp_id(data a,data b)
{
    return a.id<b.id;
}
int lowbit(int x)
{
    return x&(-x);
}
void add(int x,int d)
{
    for(int i=x;i<=n;i+=lowbit(i))
    tree[i]+=d;
    sum+=d;
}
int query1(int x)//统计树状数组后面 
{
    int tot=0;
    for(int i=x;i>0;i-=lowbit(i))
    tot+=tree[i];
    return sum-tot;
}
int query2(int x)//统计树状数组前面 
{
    int tot=0;
    for(int i=x-1;i>0;i-=lowbit(i))
    tot+=tree[i];
    return tot;
} 
void init()
{
    scanf("%d",&n);
    int block=(int)sqrt(n);
    for(int i=1;i<=n;i++){
        pos[i]=(i-1)/block+1;
        scanf("%d",&siz[i]);
        val[i]=siz[i];
    }
    sort(val+1,val+1+n);
    int tot=unique(val+1,val+1+n)-val;
    for(int i=1;i<=n;i++)
    siz[i]=lower_bound(val+1,val+tot,siz[i])-val;
    scanf("%d",&q);
    for(int i=1;i<=q;i++){
        scanf("%d%d",&a[i].l,&a[i].r);
        a[i].id=i;
    }
}
void solve()
{
    for(int i=a[1].l;i<=a[1].r;i++)
        add(siz[i],1),ans+=query1(siz[i]);
    rt[a[1].id]=ans;
    int pl=a[1].l,pr=a[1].r;
    for(int i=2;i<=q;i++){
        for(;pl<a[i].l;pl++)//多了 统计前面的 
        add(siz[pl],-1),ans-=query2(siz[pl]);
        for(;pl>a[i].l;pl--)//已有的数都是在它的后面,所以统计树状数组前面 
        add(siz[pl-1],1),ans+=query2(siz[pl-1]);
        for(;pr<a[i].r;pr++)//少了 统计后面的 
        add(siz[pr+1],1),ans+=query1(siz[pr+1]);
        for(;pr>a[i].r;pr--)//多了 
        add(siz[pr],-1),ans-=query1(siz[pr]);
        if(a[i].r==a[i].l) {
            rt[a[i].id]=0;
            continue;
        }
        rt[a[i].id]=ans;
    }
}
int main()
{
    init();
    sort(a+1,a+1+q,cmp);
    solve();
    sort(a+1,a+1+q,cmp_id);
    for(int i=1;i<=q;i++)
    printf("%d\n",rt[i]);
    return 0;
}

DBeaver 实战:手动配置 PostgreSQL JDBC 驱动的高级技巧 本文详细介绍了在DBeaver中手动配置PostgreSQL JDBC驱动的高级技巧。针对企业内网、多版本数据库兼容等场景,从获取官方驱动文件、创建自定义驱动配置,到使用Maven坐标管理、连接参数调优及解决常见连接问题,提供了完整的实战指南,帮助开发者实现对数据库连接环境的精准掌控。 阅读详情

相关推荐

【脑电信号处理与特征提取】P2-夏晓磊:脑电的神经起源与测量

ElectroEncephaloGraphyTherefore, EEG produces a graphed representation of the electrical activity occurring in a person’s brain.(把一个人的大脑中的电活动画出来)脑电头皮表面记录到的大脑活动产生的电信号(微伏)。(记录位置:硬脑膜/大脑皮层表面- ECoG,神经元群- LFP与MUR/MUA:活动位置:心电、眼电、肌电等)脑电图电压随时间变化的波形图。

m0_51474171的博客 1893

BZOJ3289

题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=3289 题意:求区间逆序对。 题解:莫队,然后树状数组求逆序对。 注意:要离散化。 比如l,r这段区间增加前面增加一个数a[l-1], 只用考虑l,r这段区间里比 a[l-1]-1 小的数,记为cnt, 答案减去cnt,然后更新下. 比如l,r这段区间后面加一个数a[r+1],

qq_36876305的博客 341

【两方演化博弈代码复现】:双方演化博弈的原理、概率博弈仿真、相位图、单个参数灵敏度演化

演化博弈论是研究个体在特定环境中如何通过策略选择与其他个体进行互动的学科。这一理论在生物学、经济学和社会科学等多个领域都有广泛应用。本文将深入探讨双方演化博弈的原理及其过程,并解读一段 MATLAB 代码,展示如何模拟这一过程。

当回首往事的时候,不会因虚度年华而悔恨,也不会因碌碌无为而羞愧。 6198

【BZOJ 3289】 Mato的文件管理

【BZOJ 3289】 Mato的文件管理 莫队算法~

Regina8023 1222

保姆级教程:Synology NAS共享文件夹从创建到权限设置的完整流程

本文提供了一份详尽的Synology NAS共享文件夹创建与权限设置指南。重点讲解了如何将NAS接入企业AD域,并利用域管理员账户进行集中身份验证和权限管理。文章从基础概念、域环境配置、文件夹创建、精细化权限分配到客户端访问与维护,完整覆盖了构建安全高效企业级文件共享空间的全流程,旨在帮助管理员实现便捷的团队协作与数据安全管理。

u9v0w的博客 552

从零构建:如何用MATLAB和SDR硬件搭建你的第一个OFDM卫星通信原型系统

本文详细介绍了如何利用MATLAB和SDR硬件从零构建OFDM卫星通信原型系统。通过核心组件选型、开发环境配置、OFDM算法实现到系统集成与优化的完整流程,帮助通信工程学生和DIY爱好者快速掌握软件无线电技术在卫星通信中的应用。特别推荐使用HackRF One和MATLAB工具箱实现高性价比的OFDM系统验证。

pz890123456的博客 378

【BZOJ】3289: Mato的文件管理【区间逆序对,莫队套树状数组】

传送门:【BZOJ】3289: Mato的文件管理 my code: #include #include #include #include using namespace std ; typedef long long LL ; #define rep( i , a , b ) for ( int i = ( a ) ; i < ( b ) ; ++ i ) #defi

poursoul 1556

QT邂逅豆包API:打造专属文章生成神器

通过本次探索,我们成功基于 QT 调用豆包 API 开发出了文章生成工具。从前期的准备工作,到核心代码的实现,再到功能的拓展与优化,每一步都凝聚着技术的魅力与挑战。我们学会了申请豆包 API 密钥,搭建 QT 开发环境,创建网络请求类来与豆包 API 进行交互,构建请求体并解析响应,还为工具添加了友好的界面交互,提升了性能。

大雨淅淅的博客 1973

[BZOJ3289]Mato的文件管理 Solution

题意:给一个序列,若干个询问,每次询问一个区间的逆序对个数。 考虑数据范围很小,就可以使用莫队,如何计算扩展的一个点的贡献?用树状数组维护即可。 code:code:code: #include <bits/stdc++.h> #define int long long #define regi register int int n,q; int a[51000]; int tmp[5...

chenzhuo__的博客 187

ChatTutor:让AI老师“会写会画”,打造可视化、互动式智能教育新范式

ChatTutor是一款突破性的开源AI教学助手,通过可视化电子白板实现"边讲边写"的沉浸式教学体验。该项目支持数学公式手写输入、动态函数绘图、自动生成思维导图等功能,采用多智能体架构实现专业协同。未来将扩展至编程、物理等STEM教育领域,适用于学生自学、教师备课和教育平台集成。作为MIT协议开源项目,ChatTutor通过赋予AI"教学肢体语言",推动教育从信息传递转向可视化互动建构,重新定义了AI助教的可能性。

这里汇聚了前沿的技术分享与实用的开发技巧,带你探索从创意到企业的技术创业之路。 423

Qt/C++编写自定义控件42-开关按钮

一、前言 从2010年进入互联网+智能手机时代以来,各种各样的APP大行其道,手机上面的APP有很多流行的元素,开关按钮个人非常喜欢,手机QQ、360卫士、金山毒霸等,都有很多开关控制一些操作,在Qt widgets应用项目上,在项目中应用些类似的开关按钮,估计也会为项目增添不少新鲜感。 总结了大部分的开关按钮控件,基本上有两大类,第一类是纯代码绘制,这种对代码的掌控度要求比较高,但是灵活性比较好...

Qt/C++视频监控/推流/物联网/大屏系统/自定义控件/UI定制/输入法 3327

BZOJ_3289_Mato的文件管理_莫队+树状数组

BZOJ_3289_Mato的文件管理_莫队+树状数组 Description Mato同学从各路神犇以各种方式(你们懂的)收集了许多资料,这些资料一共有n份,每份有一个大小和一个编号 。为了防止他人偷拷,这些资料都是加密过的,只能用Mato自己写的程序才能访问。Mato每天随机选一个区间[l,r ],他今天就看编号在此区间内的这些资料。Mato有一个习惯,他总是从文件大...

185

【物联网】基于LORA组网的远程环境监测系统设计(ThingsCloud云平台版)_资料编号34

实现一主多从的LORA组网远程通信,主机和两个从机都配备了STM32F103单片机与 LoRa 模块,主机作为中心设备及WIFI网关,负责接收和发送数据到远程物联网平台和手机APP,两个从机则负责采集数据并通过各自的 LoRa组网将数据发送给主机。

嵌入式阿齐Archie 1万+

【BZOJ3289】【莫队分块+树状数组求逆序对】Mato的文件管理

3289: Mato的文件管理 Time Limit: 40 Sec  Memory Limit: 128 MB Submit: 1123  Solved: 495 [Submit][Status][Discuss] Description Mato同学从各路神犇以各种方式(你们懂的)收集了许多资料,这些资料一共有n份,每份有一个大小和一个编号。为了防止他人偷拷,这些资料都是加密过的

snowy_smile的博客 754

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

BZOJ 3289 莫队 树状数组

BZOJ 3289 题目链接: http://www.lydsy.com/JudgeOnline/problem.php?id=3289 题意: 问[L,R]区间最少交换几次相邻数字使得整个序列有序。 思路: 统计逆序对,用树状数组。然后跑一遍莫队。 离散化部分容易超时,所以直接修改了数组。 源码:#include <cstdio> #include <cstring> #inclu

beihai2013 387

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...

bzoj3289 -- 莫队+树状数组

离线。将大小离散,然后用莫队更新树状数组和答案就可以了。 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 using namesp...

205

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

BZOJ 3289: Mato的文件管理 【莫队 + 树状数组】

任意门:https://www.lydsy.com/JudgeOnline/problem.php?id=3289 3289: Mato的文件管理 Time Limit:40 SecMemory Limit:128 MBSubmit:4917Solved:2041[Submit][Status][Discuss] Description Mato同学从各路神犇以...

weixin_30299539的博客 111

bzoj3289 Mato的文件管理 莫队+树状数组

题目链接:传送门 题目大意: 给定一个nnn个数的序列,有qqq个询问,每个询问给出区间[l,r][l,r][l,r],要求输出[l,r][l,r][l,r]区间内逆序对的数量。 n,q&lt;=5∗104n,q&lt;=5*10^4n,q<=5∗104 容易看出,最小的交换次数=区间逆序对个数(很显然,因为一次交换只能减少一个逆序对) ...

The_OIer的博客 300

BZOJ3289 Mato的文件管理 莫队 树状数组

原文链接https://www.cnblogs.com/zhouzhendong/p/BZOJ3289.html 题目传送门 - BZOJ3289 题意   给定一个序列 $a$ , 有 $n$ 个元素。   给定 $m$ 次询问,每次问一个区间内,只通过交换相邻元素,问至少交换多少次才能使得区间升序。   $n,m\leq 50000$ , $a_i$ 需要离散化 题解   一道不...

weixin_30262255的博客 105

[bzoj3289]Mato的文件管理 莫队+树状数组

莫队

Unlimited Code Works 288

BZOJ 3289 Mato的文件管理 | 莫队 树状数组

BZOJ 3289 Mato的文件管理 题意 求区间逆序对。 题解 在莫队的基础上使用树状数组求逆序对。 在当前区间左侧加入一个数时,res += 原区间比它小的数的个数; 在当前区间右侧加入一个数时,res += 原区间比它大的数的个数; 在当前区间左侧删除一个数时,res -= 原区间比它小的数的个数; 在当前区间右侧删除一个数时,res -= 原区间比它大的数的个数; #include &l...

weixin_30780221的博客 116

【BZOJ3289】Mato的文件管理 莫队+树状数组

题目大意:给定一个长度为 N 的序列,M 个询问,每次询问区间逆序对的个数。 题解:用树状数组加速答案转移。 代码如下 #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define mp make_pair #define all(x) x.begin(),x....

K1385170的博客 163

bzoj 3289: Mato的文件管理 莫队+树状数组

bzoj 3289: Mato的文件管理 莫队+树状数组

Rising_shit的博客 447

bzoj3289(莫队+树状数组)

经典题目。 每次删除和加入直接在树状数组里进行统计即可 #include&amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;gt; using namespace std; int a[50100] , n , Q , m; int tmp[50100]; int tr[50100] , belong[50100]; unsigned int ans,out[50100]; struct data { ...

a1035719430的博客 366

莫队+树状数组 题解【bzoj3289】Mato的文件管理

首先题目意思很简单 就是求每一段区间内的逆序对个数 在我认知中有两种求逆序对的方法 1.归并排序可以求逆序对 2.树状数组求逆序对 修改和查询都是O(logn)的复杂度 本题要不断修改逆序对数据结构只能选择树状数组 然后 就往莫队上去套咯 离线求解 分块 然后按左端点所在的块排序 再按后端点排序 定义一个L,R,不断++,–,update树状数组和更新ans就好了 不过感觉有点抽象 一个

With_thewind的博客 622
下一篇: bzoj2160 拉拉队排练 manacher+差分
五彩蒟蒻DDD
博客等级 码龄10年 20粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值