DZY Loves Topological SortingTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 922 Accepted Submission(s): 269Problem Description
A topolog...
分类:
其他好文 时间:
2015-05-01 23:53:36
阅读次数:
129
Median
Time Limit: 5 Seconds
Memory Limit: 65536 KB
The median of m numbers is after sorting them in order, the middle one number of them if
m is even or the average number of the middl...
分类:
其他好文 时间:
2015-04-28 23:05:45
阅读次数:
368
hdu2838
------希望30号驾校科目一顺利考完,4月即将过去说好的30篇博客也没完成, 真是忙起来就会烦躁什么都不想做,勿忘心安。。。。
《Cow Sorting》 这题本来兴高采烈的想用java做一遍,结果做出来之后无限超内存,真是啊,做题的时候java这种东西还是轻易不要动了。还有感觉要把数字都要离散化的,结果后台数据不需要离散化。
题意:...
分类:
编程语言 时间:
2015-04-28 23:01:55
阅读次数:
311
题目大意:
有N头奶牛排成一排。每头奶牛都有一个唯一的"坏脾气"值。坏脾气的范围为1~100000。现在将
奶牛重新排序,使奶牛按照坏脾气增加的顺序排列。所有的奶牛都可以相互交换位置。但是交换脾
气值为X,Y的两头奶牛,需要的时间是X+Y。现在问:将奶牛重新排列需要的最短时间是多少。
思路:
这道题就是给你一个N个元素的序列,求这个序列中所有逆序数的和。所以,对于值为a的第i个元素,
除了知道前i个元素里比a大的元素个数之外,还得知道前i个元素里比a大的元素的和。建立结构体树
状数组,一个变量来记录比a小...
分类:
编程语言 时间:
2015-04-28 18:28:03
阅读次数:
163
Sorting It All Out时间限制:3000ms | 内存限制:65535KB难度:3描述An ascending sorted sequence of distinct values is one in which some form of a less-than operator is...
分类:
其他好文 时间:
2015-04-28 11:08:09
阅读次数:
103
1 package sorting; 2 3 /** 4 * 归并排序 5 * 平均O(nlogn),最好O(nlogn),最坏O(nlogn);空间复杂度O(n);稳定;较复杂 6 * @author zeng 7 * 8 */ 9 public class GuibingPaixu...
分类:
编程语言 时间:
2015-04-25 22:39:12
阅读次数:
173
1 package sorting; 2 3 /** 4 * 基数排序 5 * 平均O(d(n+r)),最好O(d(n+r)),最坏O(d(n+r));空间复杂度O(n+r);稳定;较复杂 6 * d为位数,r为分配后链表的个数 7 * @author zeng 8 * 9 */10...
分类:
编程语言 时间:
2015-04-25 22:36:40
阅读次数:
226
1 package sorting; 2 3 /** 4 * 堆排序 5 * 平均O(nlogn),最好O(nlogn),最坏O(nlogn);空间复杂度O(1);不稳定;较复杂 6 * @author zeng 7 * 8 */ 9 public class DuiPaixu {10...
分类:
编程语言 时间:
2015-04-25 22:32:39
阅读次数:
199
1 package sorting; 2 3 /** 4 * 快速排序 5 * 平均O(nlogn),最好O(nlogn),最坏O(n^2);空间复杂度O(nlogn);不稳定;较复杂 6 * @author zeng 7 * 8 */ 9 public class Kuaisupai...
分类:
编程语言 时间:
2015-04-25 22:29:42
阅读次数:
294
1 package sorting; 2 3 /** 4 * 选择排序 5 * 平均O(n^2),最好O(n^2),最坏O(n^2);空间复杂度O(1);不稳定;简单 6 * @author zeng 7 * 8 */ 9 public class XuanzePaixu {10 11...
分类:
编程语言 时间:
2015-04-25 22:25:41
阅读次数:
199