上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 99 下一页

2012年8月9日

Card

摘要: 算法:暴力枚举找循环节。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using namespace std;int T,N,L,R;int card[100];int pcar 阅读全文

posted @ 2012-08-09 16:54 more think, more gains 阅读(176) 评论(0) 推荐(0) 编辑

2012年8月8日

最近点对 HDU 1007

摘要: TLE。。。求出答案完全正确。就是无法处理极端情况,比如100000个X坐标相同的点,因为我是对其值进行分治,时间复杂度O(N× N)。TLE。。。修改后的算法:先对X排序,然后递归分治(1,N)区间,而不是对其实际的值进行分治.分治得到两边最小的值是ans,最后合并时,找出x坐标>= p[mid].x - ans, <= p[mid].x + ans的点,并对其按Y轴排序。两个点Y值>= ans的点 break;AC代码,二分找两边左边View Code #include<stdio.h>#include<stdlib.h>#include 阅读全文

posted @ 2012-08-08 22:02 more think, more gains 阅读(281) 评论(0) 推荐(0) 编辑

最远点对 凸包 POJ 2187

摘要: http://blog.csdn.net/a81895898/article/details/7592156模版:平均时间复杂度O(nlgn),最坏O(n * n)View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include& 阅读全文

posted @ 2012-08-08 11:11 more think, more gains 阅读(164) 评论(0) 推荐(0) 编辑

Revolving Digits

摘要: 算法:扩展KMP + KMP找循环节View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>#define MAXN 300010using namespace std;char S[MA 阅读全文

posted @ 2012-08-08 10:53 more think, more gains 阅读(138) 评论(0) 推荐(0) 编辑

AC自动机 HDU 2222

摘要: AC自动机分为三部分:1.构造字典树2.构找失败指针3.匹配解决的问题: 如给你n个单词,然后一篇问章,问你这篇文章中单词出现了多少次?View Code /*程序说明:多模式串匹配的AC自动机算法此题通过hdu 2222自动机算法可以参考《柔性字符串匹配》里的相应章节,讲的很清楚*/#include <stdio.h>#include <string.h>const int MAXQ = 500000+10;const int MAXN = 1000000+10;const int MAXK = 26; //自动机里字符集的大小 struct TrieNode{ Tr 阅读全文

posted @ 2012-08-08 07:52 more think, more gains 阅读(152) 评论(0) 推荐(0) 编辑

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 99 下一页

导航