hdu 5213 容斥&& 莫队算法

threadX的USBX的初始化和解初始化的分析。 tx_application_define的最后会使用tx_byte_pool_create创建usb线程的内存空间“ux_device_app_byte_pool”,再创建usb线程,也就是执行。主要就是创建了线程,也就是第3个参数app_ux_device_thread_entry,这个参数内是MX_USB_Device_Init,也就是USB底层初始化。进来的参数只有1个,是memory_ptr,这个就是创建的usb线程空间“ux_device_app_byte_pool” 阅读详情

问题描述

wld有n个数(a1...an)
保证对于任意1≤i≤n,1≤ai≤n
wld有一个常数k保证2≤k≤2∗n
为了消除歧义保证k为奇数
他有m个询问
每个询问有参数l1,r1,l2,r2
保证(1≤l1≤r1<l2≤r2≤n)
对于每个询问你需要回答有多少个二元组(i,j)满足:
l1≤i≤r1且l2≤j≤r2且ai+aj=k
保证1≤n≤30000,1≤m≤30000

输入描述

多组数据(最多5组)
对于每组数据:
第一行:一个数n表示数的个数
接下来一行:一个数k表示wld的常数
接下来一行:n个数,依次为a1,a2,…an
接下来一行:一个数m表示询问数
接下来m行:四个数l1,r1,l2,r2表示这组询问的参数

输出描述

对于每组数据:
对于每个询问输出二元组的数目

输入样例

5
3
1 2 1 2 3
1
1 2 3 5 

输出样例

2

Hint

a1 + a4 = 3
a2 + a3 = 3

//未解决。不知道为甚么错了。

参考https://vjudge.net/solution/5146082和http://blog.youkuaiyun.com/qq_24451605/article/details/46411115

        #include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define mem(a,b) memset(a,b,sizeof(a));
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define MP make_pair
#define ULL unsigned long long
#define LL   long long
#define inf 0x3f3f3f3f
#define md ((ll+rr)>>1)
#define ls (i<<1)
#define rs (ls|1)
#define eps 1e-8
#define ree freopen("in.txt","r",stdin);
#define bug pf("----------------");
#define N 30010
#define mod 475
#define double long double
#define  pii pair<int,int>
#define MP make_pair
#define lson ll,md,ls
#define rson md+1,rr,rs
#define pii pair<int,int>
#define B 180
//2017年09月08日14:37:08
//2017年09月08日14:56:51
//2017年09月08日15:14:54
struct Node{
    int l,r,id,v;
    void init(int _l,int _r,int _id,int _v){
        l=_l,r=_r,id=_id,v=_v;
    }
}node[N];
int pos[N];
int now;
bool cmp(Node a,Node b){
    if(pos[a.l]!=pos[b.l])return pos[a.l]<pos[b.l];
    return a.r<b.r;
}
int n,k,m;
int a[N];
int ans[N];
int tot[N];
void addit(int l,int r,int v){
    for(int i=l;i<=r;++i){
        if(k>a[i])now+=v*tot[k-a[i]];
        tot[a[i]]+=v;
    }
}
int main(){
    ree
    while(~sf("%d",&n)){
        sf("%d",&k);
        rep(i,1,n)sf("%d",&a[i]),pos[i]=(i-1)/B+1;
        mem(tot,0);
        sf("%d",&m);
        int cnt=0;now=0;
        rep(i,1,m){
            int l1,r1,l2,r2;
            sf("%d%d%d%d",&l1,&r1,&l2,&r2);
            node[++cnt].init(l1,r2,i,1);
            node[++cnt].init(l1,l2,i,-1);
            node[++cnt].init(r1,r2,i,-1);
            node[++cnt].init(r1,l2,i,1);
        }
        sort(node+1,node+1+cnt,cmp);
        for(int i=1,l=1,r=0;i<=cnt;++i){
            if(l<node[i].l)addit(l,node[i].l-1,-1);
            if(l>node[i].l)addit(node[i].l,l-1,1);
            if(r>node[i].r)addit(node[i].r+1,r,-1);
            if(r<node[i].r)addit(r+1,node[i].r,1);
            l=node[i].l;r=node[i].r;
            pf("%d\n",now);
            ans[node[i].id]+=node[i].v*now;
        }
        rep(i,1,m){
            pf("%d\n",ans[i]);
        }
    }
}
YOLO11全网首发:CVPR2026 Transformer注意力 | BinaryAttention 1-bit注意力,推理提速100%,超越FlashAttention2 本文改进:BinaryAttention 结合YOLO11的C3k2模块,全网首发创新。 阅读详情

相关推荐

Chapter 19 Digital Phase-Locked Loops

数字锁相环 Digital Phase-Locked Loops, 就是根据原来时钟信号, 产生新的时钟信号, which is locked or synchronized. (align 参考时钟边沿 or 在中间)

2304_76736886的博客 973

hdu_5213_Lucky(莫队算法+容斥定理)

题目连接:hdu_5213_Lucky 题意:给你n个数,一个K,m个询问,每个询问有l1,r1,l2,r2两个区间,让你选取两个数x,y,x,y的位置为xi,yi,满足l1 题解:首先,这题没有修改操作,即可以离线,离线区间问题就要想到莫队算法,然后看状态怎么搞,因为要求的答案满足区间的可加性,我们令f(l,r)表示 l到r这个区间满足条件的ans,令F(l1,r1,l2,r2)为在这两个区

bin_gege的博客 704

深信服aCloud虚拟存储VS3.0实战:从数据分片到仲裁机制的全流程解析

本文深度解析了深信服aCloud虚拟存储VS3.0的核心架构与生产级实践。从数据分片、条带化写入、多副本机制到智能缓存分层,详细阐述了其如何实现高性能与高可靠性的平衡。同时,深入剖析了动态均衡、平滑扩容以及故障恢复与仲裁机制,为运维人员和技术决策者提供了在超融合基础架构(HCI)中部署和管理虚拟存储的实战指南。

net55的博客 588

hdu5213 莫队算法

题目链接hdu5213解法把一次查询通过容斥拆分成四个查询,用一个数组记录不同数字出现个数,本以为是我更新顺序写挫,其实是1和2打窜了。。。 样例依然是对的,我服了,怎么写样例永远对。。#include<cstdio> #include<algorithm> #include<cstring>using namespace std;const int SIZE = 30005; const int

czw's blog 626

单细胞轨迹分析实战:基于Monocle和CytoTRACE的细胞分化潜能与状态解析

本文提供了基于Monocle和CytoTRACE的单细胞轨迹分析实战指南。通过乳腺癌数据集,详细演示了从数据准备、伪时序分析、细胞分化潜能评估到分支点功能挖掘的全流程。结合两种工具的优势,能有效解析细胞状态动态演变,为发育和疾病研究提供关键见解。

weixin_29070861的博客 478

OPC与AI智能体集成实战:一人公司的技术栈构建与避坑指南

1. 先搞清楚“一人公司”和“AI工具”到底在解决什么问题 最近看到不少关于“裸辞搞OPC一人公司”和“AI时代骗局”的讨论,结合搜索热词里高频出现的 openclaw 、 AI编程 、 OPC ,我觉得有必要把这里面的水搅一搅,说点实在的。 首先得拆开看。标题里混了三个东西: 一人公司 、 OPC/OpenClaw 、 AI培训 。它们被放在一起讨论“骗局”,但本质上解决的是不同层面的问题。 一人公司 ,或者说个人工作室、独立开发者模式,核心是 用最小化团队(甚至一个人)去承接项目、开发产品或提供服务 。

weixin_29038345的博客 320

hdu-5213(莫队算法)

莫队算法介绍: 莫队算法是离线处理一类区间不修改查询类问题的算法。就是如果你知道了[L,R]的答案。你可以在O(1)的时间下得到[L,R-1]和[L,R+1]和[L-1,R]和[L+1,R]的答案的话。就可以使用莫队算法。 莫队算法预先知道了所有的询问。可以合理的组织计算每个询问的顺序以此来降低复杂度。要知道我们算完[L,R]的答案后现在要算[L',R']的答案。由于可以在O(1)的时间下

AC之路 1078

github创建账号第一步始终出错

github创建账号总结:第一次注册GitHub,填好用户名邮箱密码后进入下一步就卡在哪里,上面还提示Unable to verify your captcha response等,进入网址的解决办法以及下载其他的浏览器也无法解决,用手机浏览器抱着试一试的心态竟然成功了,分享给大家。手机下载谷歌浏览器,进入GitHub正常注册,能向下继续,邮箱验证完以后再用电脑登陆就ok啦

计算机毕业论文源码,学生个人网页制作html源码。贴近用户做网络推广和互联网优化。 4376

Lucky (HDU - 5213 ,莫队算法 + 容斥原理)

一.题目链接: HDU-5213 二.题目大意: 有 n 组数,一个 k 值,m 次询问. 每次询问给出两个区间,求这两个区间内的数有多少组和为 k. 三.分析: 比较经典的莫队算法(奈何我第一次见) 莫队算法一般用来解决离线算法中的区间问题. 又被称为离线区间的万能解法(真是一个可啪的算法). 又因区间不连续,所以先要用容斥原理处理一下. 由容斥原理得:F(L1, R1, L...

The___Flash的博客 247

UFAST车道线检测 Ultra-Fast-Lane-Detection 从环境搭建到复现完成(一)

UFAST车道线检测 Ultra-Fast-Lane-Detection 从环境搭建到复现完成(一)

m0_46364958的博客 4345

优秀的 Verilog/FPGA开源项目介绍(二十七)- 小型CPU

介绍在FPGA上实现一个CPU是一个令人兴奋的事情,但是太复杂的CPU实现起来太难,而且不适合去了解计算机的架构,所以今天介绍一些小型的CPU,比如8051、MIPS、MSP430等~关于RISC-V的项目,请查看《优秀的 Verilog/FPGA开源项目介绍(二)-RISC-V》ZipCPUhttp://zipcpu.com/about/zipcpu.html项目介绍Z...

OpenFPGA的博客 2574

【HDU 5213 Lucky】 莫队算法

HDU5213 给你一个n个数的序列a,给你q个询问,每次询问给两个不相交的区间,求a[i]+a[j]=k的方案数 i属于第一个区间,j属于第二个区间。 对于这种两个区间内查询得问题,我们要看看能不能转化为一个区间之内的查询操作。 我们设f(l,r)f(l,r)f(l,r)为[l,r][l,r][l,r]区间内选i,j,a[i]+a[j]=ka[i]+a[j]=ka[i]+a[j]=k的方...

lajiyuan的博客 288

SDA 还是 SDI:SAP HANA 数据虚拟化与数据集成的取舍、组合与实战

结论先放在前面:SDA 面向数据虚拟化与联邦查询,强调不落地、不复制、按需实时访问;SDI 面向数据集成与复制,强调抽取、转换、装载与近实时增量同步。两者共享 Remote Source 与 Adapter 的理念,但侧重点与运行时组件明显不同。

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

HDU-5213,洛谷-P1494 (莫队算法)

题目链接: 小Z的袜子 思路 莫队算法用于解决离线处理问题,即先把所有询问记录一遍,对询问的进行排序操作后,最终一起输出答案。对于区间询问,其实我们就是设置了两个指针L,R,我们其实可以在O(1)的时间内完成从【L,R】的询问到【L+1,R】或者是【L,R+1】的询问,因此排序的原因就是使得指针跳来跳去的次数能够减少一些。 #include &amp;lt;bits/stdc++.h&amp;gt; usin...

“”云腾致雨“”的博客 225

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

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

HDU5213(容斥定理+莫队算法)

传送门 题意 给出n个数和幸运数k,m次询问,每次询问[l1,r1]和[l2,r2]有多少对数满足x+y=k,x∈[l1,r1],y∈[l2,r2] 分析 看到m只有3e4,可以考虑\(m\sqrt{n}\)的莫队算法,具体讲解。首先设f(l,r)表示从l到r满足x+y=k的对数,那么由容斥定理得到,\[f(l1,r1,l2,r2)=f(l1,r2)-f(l1,l2-1)-f(r1+1,...

anquan1533的博客 148

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

hdu 5213 Lucky && 莫队算法的理解

题意: Lucky    Accepts: 34    Submissions: 267  Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) 问题描述 wld有n个数(a1...an) 保证对于任意1≤i≤n,1≤ai≤n wld有一

c337134154的专栏 1441

hdu 5213(容斥原理+莫队算法)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5213 莫队算法是离线处理一类区间不修改查询类问题的算法。就是如果你知道了[L,R]的答案。你可以在O(1)的时间下得到[L,R-1]和[L,R+1]和[L-1,R]和[L+1,R]的答案的话。就可以使用莫队算法。 对于莫队算法我感觉就是暴力。只是预先知道了所有的询问。可以合理的组织计算

hexianhao的博客 1069

HDOJ 5213

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5213 BC 上的题,题解很清楚,会莫对的应该不难, 对于一个询问,我们拆成四个询问,开始拆成求区间矩形的样子,我想多了。 然后就是模板的莫队了。 一个变量打错,一直DEBUG   1 #include<stdio.h> 2 #include<algor...

weixin_30328063的博客 153

Lucky - HDU 5213 莫队算法

Lucky Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 419    Accepted Submission(s): 143 Problem Description WLD is always very luc

提比的强行AC 542

hdu 5213 Lucky(莫队算法分块+容斥定理)

Lucky Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 418    Accepted Submission(s): 142 Problem Description WLD is always very lucky.H

llin-黎辰 1351

hdu5213(莫队算法+容斥定理)

借鉴了一位大佬的博客:https://www.cnblogs.com/HDUjackyan/p/8996172.html 题目链接:http://acm.hdu.edu.cn/userloginex.php 题意:给我们n个数,然后给我们一个数字K,再给我们两个区间[L,R],[U,V],问我们从这两个区间里分别取一个数,有多少种取法,可以使得所取的两个数和为K。 分析:莫队算法+容斥定理。...

行云出岫 355

【HDU5213 BestCoder Round 39D】【莫队算法+容斥】Lucky 两个区间各选一个数使得和为K的方案数

#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; void fre(){freopen("c://test//input.in","r",stdin);freopen("c:

snowy_smile的博客 1032

HDU 5213 Lucky 离线莫队+容斥

/* HDU 5213 Lucky 离线莫队+容斥; 链接:http://acm.hdu.edu.cn/showproblem.php?pid=5213 题意:所给两个区间各选一个数的和为k的二元组的数量; 分析:直接对两个区间进行莫队离线 显然是不可行的 移动的次数较多--&gt;TLE; 考虑将两个区间进行合并 容斥原理 假设所选区间为 f(l,r) :表示区间[l,r]满足题意的二元组...

布呗之路 267

专题训练3 莫队算法题目清单

bzoj 2048(入门) 题解:https://blog.youkuaiyun.com/qq_39898877/article/details/82807192 hdu 4467 题解:https://blog.youkuaiyun.com/qq_39898877/article/details/82840862 hdu 4638 题解:https://blog.youkuaiyun.com/qq_39898877/ar...

qq_39898877的博客 656

HDU 5213 Lucky (莫队算法+容斥定理)*

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5213 #include&lt;bits/stdc++.h&gt; using namespace std; #define debug puts("YES"); #define rep(x,y,z) for(int (x)=(y);(x)&lt;(z);(x)++) #define read(x,...

满月照亮的路 313

【莫队算法】[HDU5213]Lucky

题目分析:重点是把每个两个区间的询问拆分成四个单个区间的询问。 ans[l][r][u][v]=ans[l][v]-ans[l][u-1]-ans[r+1][v]+ans[r+1][u-1];#include<cstdio> #include<map> #include<cmath> #include<cstring> #include<cstdlib> #include<algorithm> u

LiuJunhao's Blog 593

hdu5213

我们看到双区间询问,可以想一下怎么转换成单区间询问 这个用容斥原理写也非常简单 \(f(L,V)\)指的是 \(f(L,U-1)\)和\(f(R+1,V)\)指的是 会发现中间被多减了一次,所以加回来有\(f(R+1,U-1)\) 于是就转换成了单区间询问 题目没有对序列进行修改,所以可以离线处理所有询问,使用莫队算法 ...

dingxingdi的博客 358
上一篇: hdu 4366 分块 or 线段树。
下一篇: bitset入门
sega_handsome
博客等级 码龄10年 7粉丝 164原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值