码迷,mamicode.com
首页 >  
搜索关键字:树状    ( 5251个结果
POJ3784---Running Median(树状数组+二分)
Description For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements receiv...
分类:编程语言   时间:2015-04-14 12:55:57    阅读次数:167
hdoj Cow Sorting
题意:给你n个无序的数,通过相邻的两个数交换,交换的价值是两个数之和,求使之increasing order的最小代价和 与poj3270不同的是poj可以每个数任意交换,可以用置换群来做 #include #include #include #include #include using namespace std; #define ll __int64 #define N 100000+1...
分类:其他好文   时间:2015-04-14 10:01:37    阅读次数:129
hdoj 4911 Inversion 树状数组+离散化
题意:给你n个可以重复的无序数列,问经过k次相邻交换后最少还有多少对逆序数 求逆序对可以用树状数组来做,对于重复的元素,可能在sort的时候交换编号 求和的时候要注意去重,还有一种方法就是稳定排序stable_sort #include #include #include using namespace std; #define ll __int64 #define N 100000+10 ...
分类:编程语言   时间:2015-04-14 10:01:37    阅读次数:132
POJ 2352 star (树状数组)
Language: Default Stars Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 35318   Accepted: 15326 Description Astronomers often examine star maps where sta...
分类:编程语言   时间:2015-04-12 13:27:50    阅读次数:147
Hoj 1867 经理的烦恼(树状数组)
Jerry是一家公司销售部门的经理。这家公司有很多连锁店,编号为1,2,3,... Jerry每天必须关注每家连锁店的商品数量及其变化,一项很乏味的工作。在连锁店比较少的时候,Jerry喜欢计算编号在[i,j]区间内的连锁店中商品数量为素数的有多少家,但是现在连锁店的数量急剧增长,计算量很大,Jerry很难得出结果。 输入格式 题目有多组输入。每组输入第一行有三个整数:C 连锁店的数量...
分类:编程语言   时间:2015-04-12 10:44:28    阅读次数:188
POJ 2299 Ultra-QuickSort(逆序数 树状数组)
Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 45960   Accepted: 16702 Description In this problem, you have to analyze a particular sorti...
分类:编程语言   时间:2015-04-12 10:42:57    阅读次数:169
[hdu4358]树状数组
思路:用一个数组记录最近k次的出现位置,然后在其附近更新答案。具体见代码: 1 #pragma comment(linker, "/STACK:10240000,10240000") 2 3 #include 4 #include 5 #include 6 #include ...
分类:编程语言   时间:2015-04-12 06:46:52    阅读次数:188
[hdu4911]逆序对相关
思路:由于只能交换相邻的数,所以每次最多减小1个逆序对(且如果存在逆序对那么肯定可以减小1个)!于是乎。。就是统计逆序对的裸题了。树状数组或归并都行。 1 #pragma comment(linker, "/STACK:10240000,10240000") 2 3 #include 4 #in.....
分类:其他好文   时间:2015-04-12 06:44:26    阅读次数:117
Linux下的目录讲解
Linux下的目录介绍:在Linux系统中,一切东西都是存放在一个唯一的“虚拟文件系统”中的,这个“虚拟文件系统”是树状的结构以一个根目录开始。以文件来表示所有逻辑实体和非逻辑实体,逻辑实体指文件和目录,非逻辑实体泛指硬盘,终端,打印机等等Linux系统是通过“虚拟文件系统-硬盘-硬盘上的分区-分区...
分类:系统相关   时间:2015-04-11 22:24:49    阅读次数:204
数列操作问题
线段树或树状数组 1 线段树 2 #include 3 int sum[100001]; 4 struct node 5 { 6 int v, a, b, left, right; 7 }; 8 node tree[200100]; 9 int tot=0, d, k, s, t;10 v...
分类:其他好文   时间:2015-04-11 19:17:08    阅读次数:236
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!