
主席树
文章平均质量分 62
NOIAu
最后一天啦~
展开
-
对Kth number的一点小研究——主席树
显然网上已经有太多的人写过这道题的题解了,而且大家都写得挺详细的,这里我就分析一份代码,没学过的同学在看了别人的博客之后看这个代码分析,应该可以很快解决主席树的基础学习#include<cstdio>#include<cstring>#include<iostream>#include<cmath>#include<algorithm>#include<vector>#include<m原创 2017-08-02 11:52:48 · 417 阅读 · 0 评论 -
BZOJ 3524: [Poi2014]Couriers 主席树题解
Time Limit: 20 Sec Memory Limit: 256 MB Submit: 2314 Solved: 897Description给一个长度为n的序列a。1≤a[i]≤n。 m组询问,每次询问一个区间[l,r],是否存在一个数在[l,r]中出现的次数大于(r-l+1)/2。如果存在,输出这个数,否则输出0。Input第一行两个数n,m。 第二行n个数,a[i]。 接下原创 2017-08-02 15:49:24 · 404 阅读 · 0 评论 -
HDU - 2665 Kth number 主席树题解
DescriptionGive you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases. For each test case, the first line contain two integer n and m (n, m <=原创 2017-08-02 17:33:51 · 467 阅读 · 0 评论 -
COGS 930. [河南省队2012] 找第k小的数
时间限制:1 s 内存限制:128 MB题目描述看到很短的题目会让人心情愉悦,所以给出一个长度为N的序列A1,A2,A3,…,AN, 现在有M个询问,每个询问都是Ai…Aj中第k小的数等于多少。输入格式第一行两个正整数N,M。 第二行N个数,表示序列A1,A2,…,AN。 紧着的M行,每行三个正整数i,j,k(k≤j-i+1),表示 询问Ai…Aj中第k小的数等于多少。输出格式共输出M行原创 2017-08-03 10:21:58 · 750 阅读 · 0 评论 -
COGS 1534 [NEERC 2004]K小数 主席树题解
时间限制:2 s 内存限制:512 MB【中文题意】给出一个长度为n的序列a1~an,有m次询问(x,y,k),每次询问a[x]~a[y]内的第k小数。 输入第一行为n,m,第二行为a1~an,接下来m行是m个(x,y,k)。 由于数据较大,请使用C风格的输入输出。 1<=n<=100000,1<=m<=5000【题目描述】You are working for Macrohard com原创 2017-08-03 10:40:23 · 495 阅读 · 0 评论 -
BZOJ 1803: Spoj1487 Query on a tree III 主席树题解
Time Limit: 1 Sec Memory Limit: 64 MB Submit: 595 Solved: 268DescriptionYou are given a node-labeled rooted tree with n nodes. Define the query (x, k): Find the node whose label is k-th largest in t原创 2017-08-04 09:44:35 · 459 阅读 · 0 评论