- 博客(49)
- 资源 (3)
- 收藏
- 关注
原创 差分约束及其模板
关于差分约束,《算法导论》讲的挺明白的了。有一点要注意的是x1-x2x1的边权为w的一条边,而不是x1->x2,这一点不要搞糊涂了。以下是我的差分约束的模板,解决的是《算法导论》上的例子:#include #include #include using names
2011-08-12 14:42:20 531
原创 拓扑排序简介
拓扑排序简介2010-08-16 11:19简单的说,由某个集合上的一个偏序得到该集合上的一个全序,这个操作称之为拓扑排序。离散数学中关于偏序和全序的定义: 若集合X上的关系是R是自反的、反对称的和传递的,则称R是集合X上的偏序关
2011-08-11 11:18:32 490
原创 二分图最大匹配总结
1。一个二分图中的最大匹配数等于这个图中的最小点覆盖数【转自Matirx67】König 定理是一个二分图中很重要的定理,它的意思是,一个二分图中的最大匹配数等于这个图中的最小点覆盖数。如果你还不知道什么是最小点覆盖,我也在这里说一 下:假如选了一个点就相当于覆盖了以它为端点
2011-08-09 16:37:08 486
原创 树状数组 逆序数的相关问题
有关树状数组 一维树状数组基本构造:#define lowbit(x) ( (x)&(-(x)) )void update( int pos, int value ) // 更新 pos 的值{ int x= pos; whil
2011-08-09 12:11:29 151
原创 字典树[Trie]
Trie树也叫字典树,是一种用于快速检索的多叉树结构。如英文字母的字典树是一个26叉树。数字的字典树是一个10叉树。Trie树把要查找的关键词看作一个字符序列,并根据构成关键词字符的先后顺序构造用于检索的树结构;一棵m度的Trie树或者为空,或者由m棵m度的Trie树构成。特别的
2011-08-08 09:21:47 494
原创 B - Mayor's posters
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:25:10 552
原创 Z - Atlantis
Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:23:33 356
原创 Y - Picture
Time Limit: 2000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:23:11 478
原创 X - Milking Grid
Time Limit: 3000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:20:56 801
原创 W - Period
Time Limit: 3000MS Memory Limit: 30000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:20:30 463
原创 V - Power Strings
Time Limit: 3000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:19:34 594
原创 U - Seek the Name, Seek the Fame
Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:18:19 528
原创 T - Oulipo
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:17:36 517
原创 S - T9
Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:16:37 589
原创 R - Babelfish
Time Limit: 3000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:15:33 341
原创 Q - Colored Sticks
Time Limit: 5000MS Memory Limit: 128000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:14:27 413
原创 P - Shortest Prefixes
Time Limit: 1000MS Memory Limit: 30000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:13:57 507
原创 O - Is It A Tree?
Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:13:22 384
原创 N - 食物链
Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:11:46 373
原创 M - The Suspects
Time Limit: 1000MS Memory Limit: 20000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:11:05 380
原创 L - Play on Words
Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:10:08 373
原创 K - Mobile phones
Time Limit: 5000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:08:47 535
原创 J - Necklace
Time Limit: 5000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:07:02 354
原创 I - Matrix
Time Limit: 3000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:06:00 618
原创 H - Japan
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:04:32 9729
原创 G - Apple Tree
Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:03:44 411
原创 F - Billboard
Time Limit: 8000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:01:35 414
原创 E - Frequent values
Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 18:01:02 551
原创 E - Frequent values
Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 17:14:04 125
原创 D - A Simple Problem with Integers
Time Limit: 5000MS Memory Limit: 131072KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 17:12:20 367
原创 C - Count Color
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 17:10:36 728
原创 B - Mayor's posters
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 17:01:28 222
原创 A City Horizon
Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Status]Description
2011-08-07 17:00:47 399
转载 kmp 详解
我们这里说的KMP不是拿来放电影的(虽然我很喜欢这个软件),而是一种算法。KMP算法是拿来处理字符串匹配的。换句话说,给你两个字符串,你需要回答,B串是否是A串的子串(A串是否包含B串)。比如,字符串A="I'm matrix67",字符串B="matrix",我们就说B是A的子
2011-08-07 13:44:30 751 1
转载 kmp算法详解
个人觉得这篇文章是网上的介绍有关KMP算法更让人容易理解的文章了,确实说得很“详细”,耐心地把它看完肯定会有所收获的~~,另外有关模式函数值next[i]确实有很多版本啊,在另外一些面向对象的算法描述书中也有失效函数 f(j)的说法,其实是一个意思,即next[j]=f(j-1)
2011-08-07 09:47:37 626
原创 poj 2299树状数组求逆序数
Time Limit: 7000MS Memory Limit: 65536KTotal Submissions: 15773 Accepted: 5563DescriptionIn this problem, you ha
2011-08-06 11:22:09 1959
原创 hdu 3874(树状数组)
#include#include#include#include#includeusing namespace std;const int maxn=50010;//离线算法int n;__int64 c[maxn];int lowbit(
2011-08-06 11:13:28 792
原创 树状数组区间求和三种模型
树状数组在区间求和问题上有大用,其三种复杂度都比线段树要低很多……有关区间求和的问题主要有以下三个模型(以下设A[1..N]为一个长为N的序列,初始值为全0):(1)“改点求段”型,即对于序列A有以下操作:【1】修改操作:将A[x]的值加上c;【2】求
2011-08-05 23:44:33 8190 5
原创 Babelfish
R - BabelfishTime Limit: 3000MS Memory Limit: 65536K 64bit IO Format: %I64d & %I64u[Submit] [Go Back] [Sta
2011-08-05 22:35:50 595
原创 1182 食物链
//1182 食物链 利用向量偏移的并查集////每个集合都有三类动物,用rank表示,0——同类;1——食物;2——天敌,初始时都以自己为根节点,且rank为0//只需对每一句话,判断x,y是否同一集合内,如果是就判断语句真假,否则就合并集合//根据公式知道x-
2011-08-05 22:32:21 412
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人