POJ2104 K-th Number —— 划分树(模板题)

SquareLine Studio汉化版安装激活全攻略:LVGL嵌入式UI设计从入门到出代码 嵌入式GUI开发中,LVGL作为轻量级开源图形库,广泛应用于STM32、ESP32等MCU平台。可视化设计器通过拖拽生成LVGL代码,大幅提升UI开发效率。SquareLine Studio正是这类工具的代表,支持界面设计、事件绑定与代码导出。其安装、汉化与激活是初学者常见门槛,尤其涉及LVGL版本匹配、字体配置及FreeRTOS移植等关键环节。本文围绕汉化版安装、一个月免费激活码使用及最小可用流程展开,帮助开发者快速上手LVGL界面设计,规避常见环境与集成问题。 阅读详情

题目链接:http://poj.org/problem?id=2104.


K-th Number
Time Limit: 20000MS Memory Limit: 65536K
Total Submissions: 59744 Accepted: 20847
Case Time Limit: 2000MS

Description

You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickly k-th order statistics in the array segment. 
That is, given an array a[1...n] of different integer numbers, your program must answer a series of questions Q(i, j, k) in the form: "What would be the k-th number in a[i...j] segment, if this segment was sorted?" 
For example, consider the array a = (1, 5, 2, 6, 3, 7, 4). Let the question be Q(2, 5, 3). The segment a[2...5] is (5, 2, 6, 3). If we sort this segment, we get (2, 3, 5, 6), the third number is 5, and therefore the answer to the question is 5.

Input

The first line of the input file contains n --- the size of the array, and m --- the number of questions to answer (1 <= n <= 100 000, 1 <= m <= 5 000). 
The second line contains n different integer numbers not exceeding 10 9 by their absolute values --- the array for which the answers should be given. 
The following m lines contain question descriptions, each description consists of three numbers: i, j, and k (1 <= i <= j <= n, 1 <= k <= j - i + 1) and represents the question Q(i, j, k).

Output

For each question output the answer to it --- the k-th number in sorted a[i...j] segment.

Sample Input

7 3
1 5 2 6 3 7 4
2 5 3
4 4 1
1 7 3

Sample Output

5
6
3

Hint

This problem has huge input,so please use c-style input(scanf,printf),or you may got time limit exceed.

Source

Northeastern Europe 2004, Northern Subregion




代码如下:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <set>
using namespace std;
typedef long long LL;
const int INF = 2e9;
const LL LNF = 9e18;
const int mod = 1e9+7;
const int MAXN = 1e5+10;

int tree[20][MAXN];
int sorted[MAXN];
int toleft[20][MAXN];

void build(int l, int r, int dep)
{
    if(l==r) return;
    int mid = (l+r)>>1;
    int same = mid-l+1;
    for(int i = l; i<=r; i++)
        if(tree[dep][i]<sorted[mid])
            same--;

    int lpos = l, rpos = mid+1;
    for(int i = l; i<=r; i++)
    {
        if(tree[dep][i]<sorted[mid])
            tree[dep+1][lpos++] = tree[dep][i];
        else if(tree[dep][i]==sorted[mid] && same>0)
        {
            tree[dep+1][lpos++] = tree[dep][i];
            same--;
        }
        else
            tree[dep+1][rpos++] = tree[dep][i];
        toleft[dep][i] = toleft[dep][l-1] + lpos - l;
    }

    build(l, mid, dep+1);
    build(mid+1, r, dep+1);
}

int query(int L, int R, int l, int r, int dep, int k)
{
    if(l==r) return tree[dep][l];
    int mid = (L+R)>>1;
    int cnt = toleft[dep][r] - toleft[dep][l-1];

    if(cnt>=k)
    {
        int newl = L + toleft[dep][l-1] - toleft[dep][L-1];
        int newr = newl + cnt - 1;
        return query(L, mid, newl, newr, dep+1, k);
    }
    else
    {
        int newr = r + toleft[dep][R] - toleft[dep][r];
        int newl = newr - (r-l-cnt);
        return query(mid+1, R, newl, newr, dep+1, k-cnt);
    }
}

int main()
{
    int n, m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        memset(tree, 0, sizeof(tree));
        for(int i = 1; i<=n; i++)
        {
            scanf("%d",&tree[0][i]);
            sorted[i] = tree[0][i];
        }
        sort(sorted+1, sorted+1+n);
        build(1, n, 0);
        int s, t, k;
        while(m--)
        {
            scanf("%d%d%d",&s,&t,&k);
            printf("%d\n", query(1,n,s,t,0,k));
        }
    }
    return 0;
}


Linux系统安全学习手册 Linux反弹shell Linux系统应急响应 Linux服务器安全加固 Linux下的用户、组和权限 Linux中的gcc Linux中su和sudo的用法和区别 Linux系统python2与python3共存 Linux中grep工具的使用 Linux中环境变量的设置 Linux中常见的150个命令(干货) Linux中编写Shell脚本 LNMP环境搭建Wordpress博客 LAMP环境搭建一个Discuz论坛 Linux运维比较常用的一些脚本 Linux系统中安装软 阅读详情

相关推荐

【王道训练营 C/C++方向基础 60 题(31-40)】

王道训练营 C/C++方向基础 60 题(31-40)

qq_55805517的博客 3067

poj 2104 归并树

每次查找二分出某个数,logn时间在树中找到它的区间,二分找比它小的数的个数,三次二分= (log n)^3 解决的问题:查询某个区间内第k大的数 值得注意的是: 1.归并树,划分树都只能解决元素不重复的情况 2.多个x有相同rank的时候取最大的x 这些相同rank的数组成一个序列A1,A2,……An,之间两两不同,因为没有重复元素 若答案不是An而是Ai(1

Jackyguo1992的专栏 1029

深度探索:机器学习中的最大似然估计(MLE)原理及其应用

最大似然估计作为统计推断的核心方法,在机器学习领域具有广泛的应用价值和深远影响。尽管存在对模型假设敏感、易受异常值影响等局限性,但其直观的原理、坚实的理论基础以及高效的实现方式使其在实践中仍占据主导地位。随着深度学习、强化学习等新兴领域的快速发展,最大似然估计将继续演化并适应新的模型结构与优化框架。同时,结合现代优化算法、并行计算技术以及贝叶斯方法的融合,最大似然估计有望在保持其核心优势的同时,进一步提升参数估计的准确性和鲁棒性,为未来的机器学习研究与应用开辟更广阔的道路。

qq_51320133的博客 1万+

hdu 5412 CRB and Queries(动态区间第k大值,区间能修改)(整体二分,树状数组套平衡树,线段树套treap)

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5412 解题思路: 官方题解: In this problem, we can use BIT and Treap. We use BIT for coding skill and each element of BIT is Treap. First, for eac

piaocoder 2518

YOLO11实战:手把手教你优化钢材表面缺陷识别模型(基于NEU-DET数据集)

本文详细介绍了如何使用YOLO11优化钢材表面缺陷识别模型,基于NEU-DET数据集进行实战训练。从数据增强、模型架构优化到训练过程控制,全面解析提升钢材缺陷检测性能的关键技术,特别针对裂纹、划痕等典型缺陷提出针对性解决方案。

weixin_29081163的博客 379

麒麟和UOS系统编写桌面点击可执行文件

在桌面上创建一个快捷方式(.desktop 文件)来运行脚本。打开文本编辑器,创建一个新文件,如。这可以通过文本编辑器来完成。首先,确保您的脚本具有执行权限。现在,您应该可以双击桌面上的。保存此文件到桌面目录,例如,在桌面上创建一个快捷方式(文件来运行您的脚本了。使用图形界面或命令行给。现在您可以双击桌面上的。为您脚本的实际路径。是您脚本的实际路径。文件来运行您的脚本了。

u013934107的博客 7250

POJ2104(平方分割)

解题思路:以前使用主席树AC过一次的题目,现在用平方分割来试试。大致做法就是,把所有数放进MAXN大小的桶中。然后对各个桶中的数进行排序。处理时采用二分搜索的办法确定结果。即如果有1.。。n个数。则用二分来试这个数试mid是区间中第几小的数。关于平方分割处理的细节就是:把不完全包括在桶中部分用枚举的办法筛选,对于完全包括在区间内的桶,则用二分搜索。最后的复杂度为O(m*(logn)*(根号n*lo...

qq_39861441的博客 393

【GameFramework框架内置模块】2、数据节点(Data Node)

这一篇讲数据节点DataNode,基本开发程序都会有类似数据节点作用的东西,数据节点的作用其实就是保存游戏运行时的一些缓存数据,比如用户登录信息、用户名、任务节点等等。数据一般会有增删改查这四种操作,在运行时的数据一般是使用单例或者静态属性,将数据存储在内存中而数据节点也是将数据存储在内存中,但是不用序列化数据,比使用单例或者静态属性要容易维护的多,特别时它的树形结构可以让我们很好的组织我们的数据结构,方便做增删改查操作。数据节点DataNode模块的数据的存储方式是以树形结构存储。

优快云博客专家,Unity3D高级软件工程师,《Unity 3D从入门到实战》作者。 3185

poj2104 主席树

题目大意:给一串数字,多次询问区间的第k小值 思路:不带修改的主席树。第一次打主席树,所以还是参照了以下网上的模板。主席树的原理: 其实就是每添加一个数,就增加一棵树(其实是一条链),然后这条链上的计数值都+1,表示这个树链比之前的要多加了一个数。这样,想要比较第i个数与第j个数区间内,第k大的数就很好求了。只要比较s[i-1]和s[j]即可(即第i-1条树链,第j条树链),因为这两条树链的区...

qq_39861441的博客 242

仿真学习系列(四十三):Sigrity仿真之平面谐振分析

在 SIGRITY 中,平面谐振分析(Plane Resonance Analysis)是一种用于分析信号完整性(SI)问题的高级仿真方法,尤其关注于层间电磁波的传播、谐振现象和信号衰减等问题。平面谐振分析通常用于电源分配网络(PDN)、信号线和参考平面之间的相互作用。本文将详细介绍如何在 SIGRITY 中进行平面谐振分析,并提供一些实用的分析方法与步骤,帮助工程师们识别和优化可能存在的设计问题。

案例文章,高速信号 480

【Qt开发教程】网络代理QNetworkProxy类详解及实战应用

QNetworkProxy 提供了一种灵活而强大的方式来配置和管理网络代理,通过设置代理类型、主机、端口和认证信息,可以使应用程序的所有网络请求通过代理服务器进行。结合 QNetworkProxyFactory 可以实现动态代理选择和自动配置,提高应用的网络通信能力和安全性。在实际应用中,通过合理设置代理、处理代理认证和错误情况,可以确保应用程序在复杂的网络环境中稳定运行,为用户提供可靠的网络访问体验。

科技改变人类,技术成就未来 1542

poj2104 主席树(还是不太会)

这篇博客写的挺好的 推荐去看 https://blog.youkuaiyun.com/woshinannan741/article/details/53012682 Input The first line of the input file contains n — the size of the array, and m — the number of questions to answer (1 &lt...

h_666666的博客 280

一文读懂OpenClaw:核心组件与工作原理深度解析

Agent核心:负责理解意图、规划任务、协调执行消息系统:统一的消息格式,实现组件间解耦工具注册表:可扩展的工具系统,支持自定义工具模型适配层:多模型支持,统一API接口安全机制:沙箱隔离、权限确认、操作审计性能优化:并行执行、智能缓存、增量更新理解这些核心组件和工作原理,将帮助你更好地使用OpenClaw,也为后续开发自定义扩展打下坚实基础。在下一篇文章中,我们将详细介绍OpenClaw的界面操作,包括命令行与交互模式的各种技巧。

gaoxiang_120的专栏 833

POJ2104 K-th Number 划分树 模板题啊

/*Source Code Problem: 2104 User: 96655 Memory: 14808K Time: 1282MS Language: G++ Result: Accepted Source Code*/ #include<cstdio> #include<algorithm> ...

weixin_30433075的博客 129

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

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

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

poj 2104 K-th Number (划分树模板题)

You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quick

黑码 576

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

【主席树模板题||划分树模板题】B - K-th Number POJ - 2104

B - K-th Number POJ - 2104 You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that ...

qq_41037114的博客 295

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

POJ 2104 K-th Number 【划分树】

题目来源:http://poj.org/problem?id=2104 ★通过这个题来简述一下划分树的算法,算是模板题了~ 题意: 给一个长度为n的序列,然后有m次询问,每次给一个区间 输出这个区间第k大的数 思路: 具体思路参考博客:https://blog.youkuaiyun.com/zxy_snow/article/details/6681086 我就说一些没讲到的细节 划分树 结点是原序列,然...

HungTeen的博客 325

poj 2104 K-th Number(划分树)

K-th Number Time Limit: 20000MS   Memory Limit: 65536K Total Submissions: 28725   Accepted: 8602 Case Time Limit: 2000MS Description You are working for Macrohard co

志当存高远 1319

POJ 2104 K-th Number(划分树)

题意: 求区间第k小 题解: 刚看划分树,感觉划分树给我的印象就是仅仅用来求区间第k大/小… 划分树模板题,稍微写了些注释在代码中,没什么好说的 AC代码: #pragma GCC optimize(2) #include<iostream> #include<algorithm> #include<cstdio> #include<cstring&gt...

qq_43544481的博客 230

POJ2104 K-th Number

题意:给一个长度n的数列和m次查询(i,j,k),每次查询区间[i,j]内第k小数。 思路:划分树模板题。建树-查询即可,思路见代码。 #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const i

hcx11333的博客 348

POJ 2104 K-th Number

K-th Number Time Limit: 20000MS Memory Limit: 65536K Case Time Limit: 2000MS Description You are working for Macrohard company in data structures department. After failing your previous task about ke...

忘梦心的博客 395

poj 2104 K-th Number(划分树 or 主席树)

划分树模板题,敲上模板就ok了。 #include #include #include #include #include #include #include #include #include #include #define MP make_pair #define LL long long #define CLR(a, b) memset(a, b, sizeof(a)) using n

ok_again的专栏 1989

poj 2104 K-th Number 划分树

poj 2104 K-th Number //poj 2104 K-th Number //划分树 //建树和查找,模板题,具体看代码 #define infile freopen("in.txt", "r", stdin); #include <stdio.h> #include <string.h> #include <algorithm...

weixin_30852367的博客 154

POJ 2104 K-th Number 划分树

题目:http://poj.org/problem?id=2104 题意:给定一个数组,求给定区间内的第k大值 思路:划分树模板题 #include #include #include #include using namespace std; const int N = 100100; int n, m; int arr[N], arrs[N]; int cut[

弱智就要多努力 518

POJ 2104 K-th Number 初涉划分树

题意: 给一个数组,对其进行多次查询。每次查询为(L,R,K),即在闭区间内[L,R]第K大的数。 思路:本来没什么思路的,然后学长说这是划分树的模板题,然后就没有然后了...... 说一下自己对划分树的理解: 个人感觉划分树就是线段树的一种,每一个节点对应一段区间,节点内有两个数组num[],ans[]。 num[]为对应线段内的所有数据,按输入数据存放。 ans[]内存放的信

自在飞花 835

POJ--2104--K-th Number【划分树模板】

链接:http://poj.org/problem?id=2104 题意:给一个

阳光照耀圣西罗 855
上一篇: HDU1814 Peaceful Commission —— 2-sat 染色法
下一篇: HDU1403 Longest Common Substring —— 后缀数组
DOLFAMINGO
博客等级 码龄10年 8粉丝 216原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值