随笔分类 -  排序

Ultra-QuickSort(归并排序求逆序对数)
摘要:Time Limit:7000MSMemory Limit:65536KTotal Submissions:34283Accepted:12295DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending orde 阅读全文
posted @ 2013-08-13 08:49 straw_berry 阅读(201) 评论(0) 推荐(0)
Sorting It All Out
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:24354Accepted:8417DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D implies that A 2 #. 阅读全文
posted @ 2013-08-09 17:02 straw_berry 阅读(153) 评论(0) 推荐(0)
判断给定图是否存在合法拓扑排序
摘要:题目描述给定一个有向图,判断该有向图是否存在一个合法的拓扑序列。输入输入包含多组,每组格式如下。第一行包含两个整数n,m,分别代表该有向图的顶点数和边数。(n 2 #include 3 int map[11][11],vis[11],degree[11]; 4 int main() 5 { 6 int n,m,u,v,i,j,k; 7 while(~scanf("%d %d",&n,&m)) 8 { 9 memset(map,0,sizeof(map));10 memset(degree,0,sizeof(vis));//每个节点的入度初... 阅读全文
posted @ 2013-06-29 16:37 straw_berry 阅读(561) 评论(0) 推荐(0)