POJ 2761 (SBT模板)

解决VNC Viewer连接Ubuntu桌面异常:从灰屏到完整菜单栏的实战指南 本文详细解析了使用VNC Viewer连接Ubuntu桌面时出现灰屏或菜单栏缺失的常见原因及解决方案。从桌面环境冲突到配置文件错误,提供了彻底清理系统残留配置、重新安装纯净桌面环境、优化xstartup文件配置等实战步骤,帮助用户快速恢复完整的远程桌面体验。 阅读详情
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxn 100005
#define maxm 50005
int ls[maxn],rs[maxn],s[maxn],value[maxn];
int node,root;
void init()
{
    node=root=s[0]=0;
}
void Right_Rotate(int &t)
{
    int k=ls[t];
    ls[t]=rs[k];
    rs[k]=t;
    s[k]=s[t];
    s[t]=s[ls[t]]+s[rs[t]]+1;
    t=k;
}
void Left_Rotate(int &t)
{
    int k=rs[t];
    rs[t]=ls[k];
    ls[k]=t;
    s[k]=s[t];
    s[t]=s[ls[t]]+s[rs[t]]+1;
    t=k;
}
void Maintain(int &t,bool flag)
{
    if(flag)
        if(s[rs[rs[t]]]>s[ls[t]])
            Left_Rotate(t);
        else if(s[ls[rs[t]]]>s[ls[t]])
            Right_Rotate(rs[t]),Left_Rotate(t);
        else return ;
    else if(s[ls[ls[t]]]>s[rs[t]])
        Right_Rotate(t);
    else if(s[rs[ls[t]]]>s[rs[t]])
        Left_Rotate(ls[t]),Right_Rotate(t);
    else return ;
    Maintain(ls[t],0);
    Maintain(rs[t],1);
    Maintain(t,0);
    Maintain(t,1);
}
void Insert(int &t,int val)   //将键值为v的结点插入到根为t的树中
{
    if(t)
    {
        ++s[t];
        if(val<value[t]) Insert(ls[t],val);
        else Insert(rs[t],val);
        Maintain(t,val>=value[t]);
    }
    else
    {
        s[t=++node]=1;
        value[t]=val;
        ls[t]=rs[t]=0;
    }
}
int Delete(int &t,int val)   //在根为t的树中删除键值为v的结点
{
    --s[t];
    if(val==value[t]||val<value[t]&&!ls[t]||val>value[t]&&!rs[t])
    {
        int tmp=value[t];
        if(!ls[t]||!rs[t]) t=ls[t]+rs[t];
        else value[t]=Delete(ls[t],value[t]+1);
        return tmp;
    }
    else
        if(val<value[t]) return Delete(ls[t],val);
    else return Delete(rs[t],val);
}
int Pred(int t,int val) //返回根为t的树中比v小的最大的键值
{
    if(!t) return val;
    if(val<=value[t]) return Pred(ls[t],val);
    else
    {
        int tmp=Pred(rs[t],val);
        return tmp==val?value[t]:tmp;
    }
}
int Succ(int t,int val)  //返回根为t的树中比v大的最小的键值
{
    if(!t) return val;
    if(val>=value[t]) return Succ(rs[t],val);
    else
    {
        int tmp=Succ(ls[t],val);
        return tmp==val?value[t]:tmp;
    }
}
int Find(int t,int val)  //在根为t的树中查找键值为v的结点
{
    while(t&&val!=value[t])
        t=val<value[t]?Find(ls[t],val):Find(rs[t],val);
    return t;
}
int Rank(int t,int val)  //返回根为t的树中键值v的排名。也就是树中键值比v小的结点数+1
{
    if(!t) return 1;
    if(val<=value[t]) return Rank(ls[t],val);
    else return s[ls[t]]+1+Rank(rs[t],val);
}
int Select(int t,int k) //返回根为t的树中排名为k的结点。
//同时该操作能够实现Get-min,Get-max,因为Get-min等于Select(t,1),Get-max等于Select(t,s[t])
{
    if(k==s[ls[t]]+1) return value[t];
    if(k<=s[ls[t]]) return Select(ls[t],k);
    else return Select(rs[t],k-1-s[ls[t]]);
}

void Debug(int t)
{
    if(!t)
    {
        puts("empty!");
        return ;
    }
    if(ls[t])
        Debug(ls[t]);
    printf("%d ",value[t]);
    if(rs[t])
        Debug(rs[t]);
}
struct qnode
{
    int l,r,k,id;
    bool operator < (const qnode &tmp) const
    {
        return l<tmp.l;
    }
} q[maxm];
int a[maxn],ans[maxm],mp[maxn];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    init();
    for(int i=1; i<=n; i++)
        scanf("%d",a+i);
    for(int i=1; i<=m; i++)
    {
        scanf("%d%d%d",&q[i].l,&q[i].r,&q[i].k);
        q[i].id=i;
    }
    sort(q+1,q+1+m);
    q[0].l=0,q[0].r=0;
    for(int i=1; i<=m; i++)
    {
        for(int j=q[i-1].l; j<=q[i-1].r&&j<q[i].l; j++)
        if(j==0) continue;
        else Delete(root,a[j]);
        //Debug(root);
        for(int j=q[i-1].r>=q[i].l?q[i-1].r+1:q[i].l; j<=q[i].r; j++)
        {
            Insert(root,a[j]);
            //Debug(root);
        }
        ans[q[i].id]=Select(root,q[i].k);
    }
    for(int i=1; i<=m; i++)
        printf("%d\n",ans[i]);
    return 0;
}


告别抖动与滞后:深入博能传动伺服DSC功能,用105报文提升多轴同步性能 本文深入解析博能传动伺服DSC功能如何通过105报文实现多轴同步性能提升,有效解决工业自动化中的抖动与滞后问题。详细介绍了DSC技术原理、105报文实现机制及多轴同步工程实践,帮助工程师优化伺服系统性能,实现绝对齿轮同步。 阅读详情

相关推荐

AstrBot插件开发全攻略:从零编写一个天气查询插件(Python实战)

本文提供了一份详细的AstrBot插件开发实战指南,手把手教你使用Python从零编写一个智能天气查询插件。内容涵盖插件系统核心设计、开发环境搭建、API调用与数据处理、自然语言交互实现以及插件打包发布全流程,帮助你快速掌握基于AstrBot框架的聊天机器人功能扩展技能。

weixin_29212867的博客 1101

poj 2761 splay tree

这道题 可以用很多方法做像划分树之类滴~~~ 用splay虽然比划分树慢了一点,不过也只是慢了一点呀,想想有通用的解法,何必用不太常用的划分树喃~~ #include #include #include #include #define fr(i,s,n) for(int i=s;i<n;++i) #define _fr(i,n,s) for(int i=n-1;i>=s;

work_freedom的专栏 553

4 轴穿越机 Mark5 机架全解析:从历史演进到电机桨叶选型指南

本文围绕 4 轴穿越机 Mark5 机架展开,先介绍其发展历程(2018 年初代到 2023 年五代,迭代优化轻量化、刚性与兼容性),再明确其核心参数(轴距 220mm、兼容 4-6 寸桨等)对电机桨叶的约束。 详解电机(KV 值、尺寸、推力等)与桨叶(尺寸、螺距、材质等)选型要点及匹配原则(高 KV 配小桨、低 KV 配大桨),给出推重比、功率等理论计算公式,结合新手练习、花飞、竞速、航拍等场景提供具体选型案例,最后提及安全、成本、法规等注意事项,为爱好者提供全面选型参考。

bother3000的博客 1913

poj2761(静态区间第k大,treap)

题意:给你一个序列和m个区间[l,r],每次输出每个区间中第k大的值为多少。区间之间有重叠但没有完全包含。 解析:由于区间没有完全包含。所以先将区间按左端点排序,每次查询一个新区间时将其与上一个区间重叠部分保留,其余删去,在加入自己新的部分,最后查询第k大值。这是一道考察treap应用的好题。 #include #include #include #include using namespac

xffyjq的博客 589

告别远程控制弹窗:免Root实现投射与录制敏感信息自动授权

本文针对Android远程控制中频繁出现的‘在投射和录制时显示敏感信息’弹窗问题,提供了一套免Root的自动化解决方案。通过结合Shizuku与App Ops两款工具,无需破解系统即可静默授予屏幕投射与录制权限,从而实现稳定、无干扰的远程协助、家庭监控或自动化测试,彻底告别手动授权弹窗的烦恼。

qsc9012345的博客 740

瑞萨MCU定时器API实战:从Smart Configurator配置到中断与输入捕获应用

在嵌入式系统开发中,定时器(Timer)是实现精准时序控制、PWM输出和信号测量的核心硬件外设。其工作原理基于计数器在稳定时钟源驱动下递增或递减,达到预设值后触发中断或改变输出电平,从而为系统提供节拍和事件基准。通过图形化配置工具(如瑞萨的Smart Configurator),开发者可以高效地将复杂的硬件寄存器操作转化为清晰、标准化的C语言API函数,这极大地提升了开发效率并降低了出错风险。这种从硬件抽象到软件接口的技术价值在于,它使得开发者能更专注于应用逻辑,而非底层细节,尤其适用于工业控制、汽车电子等

weixin_42519733的博客 281

POJ 2761 离线线段树

题意:给出每只狗的pretty value,然后多次询问,每次输出区间[i,j](狗站成一排,从第i只到第j只)的第k小的值是多少。区间之间有交叉,但是没有完全包含。

835

华为L420X/L540X信创笔记本从麒麟系统安装Windows ARM版实操指南

在计算机系统生态中,指令集架构决定了软件运行的基础,其中ARM作为精简指令集(RISC)的代表,与x86的复杂指令集(CISC)存在根本差异,因此操作系统与驱动的兼容性成为软硬件协同的关键。ARM架构处理器凭借低功耗与高能效比,在移动计算和桌面领域持续扩展,微软也为此提供了专用的Windows ARM版本。对于信创笔记本用户而言,当专业软件、考试环境或内部工具仅支持Windows平台时,在ARM设备上完成系统切换便具有明确的工程实践价值。本文以华为L420X/L540X搭载麒麟9000C芯片的信创笔记本为实

weixin_30444111的博客 758

POJ-2761-树状数组+第k小数+离散化

#include #include #include #include #include #include #include using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 100009; const double esp = 1e-6; int n, m, num; int bef[maxn];

walk_up的专栏 1352

FreeRTOS OTA实战:从Bootloader设计到安全升级的完整流程(附MQTT示例代码)

本文详细介绍了在FreeRTOS系统中实现安全OTA固件升级的完整流程。内容涵盖从Bootloader设计、存储分区规划到与MQTT协议集成的OTA Agent任务开发,并重点解析了固件签名验证、防回滚等关键安全机制,为嵌入式物联网设备提供了一套高可靠性的远程升级解决方案。

weixin_29248653的博客 164

矿石生成(1)

这个提供了标准化的矿石放置配置模板简化了常见和稀有矿石的配置过程遵循了Minecraft原版的世界生成模式提高了代码的可读性和可维护性通过使用这个类,模组开发者可以更轻松地配置矿石的生成规则,而不需要每次都手动编写完整的放置修饰符列表。这种设计模式在原版Minecraft和其他大型模组中也很常见,是一种良好的编程实践。// 导入语句...// 字段和方法...包声明表明这个类位于luckymod模组的WorldGen包中,专门处理世界生成相关配置。导入语句。

qq_24992377的博客 143

poj 2761 Feed the dogs 平衡树,线段树,树状数组

分析:这题就是求区间第k小数,但是这题和poj2104的区别就是,2104的区间是可以完全包含的,就是说某个点进出区间不止一次,所以平衡树和线段树是超时的,只能用划分树或者归并树,这题是可以用平衡树解的。先把区间从左到右排序,然后依次插入平衡树,线段树,然后利用树的性质在log n 内找到第k小。这题也可以用树状数组解,但是需要二分第k小,我一直觉得二分不是最好的做法,考虑能不能在log n内用树

行走世间,皆为妖怪 1046

【论文翻译】YOLO26: KEY ARCHITECTURAL ENHANCEMENTS AND PERFORMANCE BENCHMARKING FOR REAL-TIME OBJECT DETEC

本研究对Ultralytics YOLO26进行了全面分析,重点阐述了其在实时边缘目标检测领域的关键架构改进与性能基准测试结果。YOLO26于2025年9月发布,是YOLO系列中最新、最先进的模型,专为在边缘设备和低功耗设备上实现高效能、高精度和部署就绪性而设计。论文依次详细介绍了YOLO26的架构创新,包括移除分布焦点损失(DFL)、采用端到端无非极大值抑制(NMS)推理、集成渐进式损失(ProgLoss)和小目标感知标签分配(STAL),以及引入MuSGD优化器以实现稳定收敛。

Limiiiing的博客 1710

静态区间第K大

两道模板题: POJ 2104 POJ 2761 做法好多,主席树,划分树,离线处理(曼哈顿最小生成树?)+BST(Treap or Splay or SBT),貌似分治+BIT也可以,不过懒得搞了。 以后复习模板时用得上。 主席树: #include #include #include #include using namespace std; const int N=100

月下沙茶树 912

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

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

POJ 2761 树状数组离线+离散化 附:线段树解法

#include #include #include #include #include #include #include #include #include #include using namespace std; const int N=100009; c

Join Hands 1221

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

poj2761静态区间第k大

例题:poj2761 题目要求:给定一个长度为n的序列,给定m个询问,每次询问求[l,r]区间内的第k大; 对于这道题目来说,很多算法都可以使用,比如说树套树(一个负责划分区间,一个负责维护这段区间内的信息),主席树等; 对这道题我使用的是主席树; 主席树对付区间第k大是很优秀的,代码短,而且常数小; 主席树的主要功能是,建立n颗范围是1-i的权值线段树,对两颗线段树做差,就可以任...

weixin_30849591的博客 155

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

poj2761(treap入门)

给n个数,然后m个询问,询问任意区间的第k小的数,特别的,任意两个区间不存在包含关系, 也就是说,将所有的询问按L排序之后, 对于i<j , Li < Lj 且 Ri < Rj 所以只要每次查询的时候,treap都是对应区间[Li,Ri] ,那么查找第k小就很简单了 1 #include <iostream> 2 #include &...

weixin_30614109的博客 170

POJ 2761 树状数组+二分+离线

关键: 1.离线操作: 将询问区间从左到右排序,然后依次插入区间内的值,在处理下一个询问时,删去上个询问插入的但当前询问不需要插入的数。 m次询问总体复杂度为 2nlog(n).  2.本题注意要离散化 3.二分(手写upper_bound)来查询第k小的数 #include #include #include using namespace std; #define maxn

Nicolas 1209

poj2761(Treap)

Feed the dogs Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 17589   Accepted: 5524 Description Wind loves pretty dogs very much, and she has n pet dogs. So

Water_Wood_的博客 505

poj 2761

也是询问第k最小数的题目,但是因为询问的区间不存在包含关系,所以可以对区间排序,然后按照左端点的顺序依次把点加入树状数组中,二分出第k值#include #include #include #include using namespace std; const int maxn=1e5+9; int n,m; int f[maxn],a[maxn]; int tr[maxn]; struc

yrleep的专栏 985

POJ 2761 Feed the dogs(Treap名次树+离线处理)

POJ 2761 Feed the dogs(Treap名次树+离线处理) http://poj.org/problem?id=2761 题意:给你N个数,然后要你对下面M个查询回答:L,R,K.回答第L个数到第R个数之间的第K小数的值是多少. 分析:        注意:题目说明中说了没有任何两个区间存在包含关系.这句话告诉我们如果将所有查询区间按L从小到大排序的话,相邻两个区间有这样的

code 2449

POJ 2761可以练习无数种数据结构的题——动态区间求第K小

Teap: #include #include #include #include const int maxn=100010; using namespace std; struct node{ node *ch[2]; int v,r,s; int cmp(int x)const{ if(x==v) return -1; return

fsdcyr 744

poj2761

题意:给出每只狗的pretty value,然后多次询问,每次输出区间[i,j](狗站成一排,从第i只到第j只)的第k小的值是多少。区间之间有交叉,但是没有完全包含。 分析:先把所有区间排序,然后从左至右把每个区间用线段树维护离散化后的pretty value,即线段树的区间的意义是pretty value。每次删除在上一个区间中且不在当前区间中的节点,插入在当前区间中且不在上一个区间中的节点,...

weixin_34362790的博客 243

POJ 2761(Treap离线求区间第k大数)

网上有好多解法,我照着LRJ的白书敲了一个板子吧,3907ms过的,这题还可以SBT过,主席树也是可以过得。划分树不知道行不行,反正做法挺多。。T_T。

crazy_石头的专栏 1926

POJ 2761 据说可以练习线段树主席树划分树splay和treap的一道题。。我用BIT+二分+离散化搞的。。

查询区间第 K 小的数,这个二分+树状数组足够了啊。 虽然我是想练练treap 的,但是看到能写 BIT 就停不下来啊。。。 离散化好恶心。。。用map T 到死。还有大于1000W 的数数组开不下,只能 hash。 找了两三个素数才过的去。 hash的时候素数不是越大越好啊。。? 中途开了好多个struct来保存信息。。。 #include #include #include

用心一也 956

POJ 2761(求区间第k小值)

Feed the dogs Time Limit: 6000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit Status Description Wind loves pretty dogs very much, and she has n pe

mowenwen_的博客 1055
上一篇: HDU 3397 Sequence operation (线段树)
下一篇: 1588: [HNOI2002]营业额统计 (splay模板)
BehappyXiang
博客等级 码龄14年 11粉丝 113原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值