摘要: http://unbelievable.ycool.com/post.1058899.html 网络流 输出路径 虽然可以在 change 段 保存 不过要注意处理反向边...所以还是很麻烦的... 所以还是求完流之后... 再递归求 为此 偶 Sgu 185 wa 了n*n 遍啊... 估计这一辈子都忘不掉了.... proced... 阅读全文
posted @ 2008-12-05 15:36 jesonpeng 阅读(166) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.1176914.html 如果是求 最小权, 把map中的值变成负数 x, y : array [1..maxn] of boolean; lx, ly : array [1..maxn] of longint; ... 阅读全文
posted @ 2008-12-05 15:36 jesonpeng 阅读(169) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.982865.html 有两种方法的... 这里先搞定一种方法吧... d[i] 表示 i节点的深度 p[i,j] 表示 i 的 2^j 倍祖先 那么就有一个递推式子 p[i,j]=p[p[i,j-1],j-1] 这样子 一个 o(n log n) 的预处理 求出 每个节点的 2^k 的祖先 然后 对于每一个 询问的... 阅读全文
posted @ 2008-12-05 15:34 jesonpeng 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.1020602.html 其实 next 的 求法和 extend一样 不过 如果 ST 时 开始条件 有些不一样.. 不过 没有关系啦 ... 还是写两遍的好 !!!! p —— 以前 匹配的 最远位置 a —— 第a个位置 时 匹配到最远 l —— 当前位置的 next 值 ... 阅读全文
posted @ 2008-12-05 15:34 jesonpeng 阅读(337) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.946604.html BST 是叫做 排序2叉树吧.... 是听说过蛮久了...可是今天才写过... 原来 ...没有我想象中那么简单的说....insert 摁了我好久哦....哎... procedure insert(var root : longint; k : l... 阅读全文
posted @ 2008-12-05 15:33 jesonpeng 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.804688.html 呀呀.... 自学凸包呀... 知道1些基本操作.... program prog3; const maxt = 1000; maxn = 1000; ... 阅读全文
posted @ 2008-12-05 15:32 jesonpeng 阅读(200) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.743864.html top sort..... o(m)... 一直... 偶都只会 O(N^2)的 .... 07-01... 有一题..用到了 O(M) 的 top sort + 指针.... 这偶就 卡住了.... 今天晚上.... 写了个程序(8过...借鉴了ZC 的...... ) ... 阅读全文
posted @ 2008-12-05 15:31 jesonpeng 阅读(136) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.787021.html 今天 又有用到并查集的题目....krustal + 并查集.... TMD 我又没有写... 郁闷.... 看来不得不来看看资料了... CX 大哥写的东西.... 还蛮有用的... 的确... 这个鸟东西运用起来 还不是那么简单的... 常常神出鬼没... 看不透行踪的... 它的... 阅读全文
posted @ 2008-12-05 15:31 jesonpeng 阅读(159) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.718426.html 嘿嘿....今天自学线段树... 听那些家伙说.... 线段树是没有什么固定算法的.... 极具改造性...我狂FT.... 反正.... 标程偶就拈在这里落: Program IntervalTree; Const Maxn=10... 阅读全文
posted @ 2008-12-05 15:28 jesonpeng 阅读(201) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.715479.html DFA是用来做多串匹配的.... 详情还是要看IOI2004ZZY的论文拉.... 反正是个很拽很拽的算法拉!!! 我好不容易写了个标程出来....狂兴奋啊...... // 其实这就是05-06-10-4 拉...... {$R-,I-,Q-,S... 阅读全文
posted @ 2008-12-05 15:25 jesonpeng 阅读(307) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.711038.html 经过06-08 的模式试题后....我对堆的感觉大大提高!!! 我把堆的基本操作都整理好...以备不时之需!!!!!(吸取教训!!!!) 以小根堆为例 上浮操作... procedure up(var heap:node;k:lon... 阅读全文
posted @ 2008-12-05 15:23 jesonpeng 阅读(180) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.706759.html 这是做ZJU 2150 时候学习的 在 实用算法的分析和程序设计上有介绍..... 大致思想 是把 B (即 指数) 转化为 2 进制.... 从低位往高位算.... 若当前这位为 1 则 d:=d*t mod n; 否则就不断的把 t:=t*t mod n ..... 自己还是不太清楚... 阅读全文
posted @ 2008-12-05 15:22 jesonpeng 阅读(156) 评论(0) 推荐(0) 编辑
摘要: http://unbelievable.ycool.com/post.696794.html 匈牙利算法真是一个不错的东西啊........ 只要是求2分图匹配...用它准没错 下面是标准程序.....(一定要狠狠的背下来.....理解...然后运用) g[i,j] ------ 这个就是 X 中的 i 是... 阅读全文
posted @ 2008-12-05 15:10 jesonpeng 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Galaxy War Time limit: 5 Seconds Memory limit: 32768K Total Submit: 25 Accepted Submit: 7 In order to count the monsters from another dimension, many stars in galaxy joint the Association... 阅读全文
posted @ 2008-12-05 15:08 jesonpeng 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Expanding Rods Time limit: 1 Seconds Memory limit: 32768K Total Submit: 460 Accepted Submit: 128 When a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L,... 阅读全文
posted @ 2008-12-05 15:05 jesonpeng 阅读(161) 评论(0) 推荐(0) 编辑
摘要: http://andyzh1314.ycool.com/post.1050683.html ZJU 2451Minimizing maximizer 题目大意 Andy想要得到一组数中的最大值。会有一系列的操作Sorter(i[1], j[1]), ..., Sorter(i[k], j[k])。作用是将数组中的第i[k]个数字到第j[k]个数字排序。按照输入给出的顺序,你可以选... 阅读全文
posted @ 2008-12-05 14:54 jesonpeng 阅读(161) 评论(0) 推荐(0) 编辑
摘要: http://andyzh1314.ycool.com/post.1050679.html Zju 2419 Triangle [凸包] 解题报告 算法是先寻找凸包,然后对凸包枚举其中一点,在枚举凸包中的另一点,第三点随着第二点的变化而变化。 我们知道最优三角形的三个点一定在凸包上,下面我们证明一下: 假设我们有最优三角形ABC中存在点不在凸包上,不妨设之为A,那么必然在凸包上存在三个点... 阅读全文
posted @ 2008-12-05 14:54 jesonpeng 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Zju 2334 monkey king [二项堆]解题报告 http://andyzh1314.ycool.com/post.1050674.html 这题应用到了一个高级数据结构:二项堆。 我对二项堆做一个介绍: 它的名字中包含堆,顾名思义它包含了所有对所具有的功能,能在log n时间内求出堆中极值,也支持对某个节点作相应的修改,除此之外它还支持堆与堆之间的合并,这点给我们解决此问题提供了... 阅读全文
posted @ 2008-12-05 14:53 jesonpeng 阅读(530) 评论(1) 推荐(0) 编辑
摘要: http://andyzh1314.ycool.com/post.1050670.html zju1346 Comparing Your Heroes [动态规划] 解题报告 用的动态规划的记忆化方法。 将得到的最优解存在了ans数组里。 程序应用到了位运算,我解释一下: 举个例子:ans[ 3 ]表示 将 3 转化成二进制 为 11他表示第一个人,和第二个人两人的排列总数。 ans[4] ... 阅读全文
posted @ 2008-12-05 14:52 jesonpeng 阅读(344) 评论(0) 推荐(0) 编辑
摘要: http://andyzh1314.ycool.com/post.1050667.html Zju 1262 Word [HASH]解题报告 By AndyZhau 单看此题是一个字符串处理的题目,其实不然。因为题目中只有a和b,换种思路来讲,二进制中也... 阅读全文
posted @ 2008-12-05 14:51 jesonpeng 阅读(150) 评论(0) 推荐(0) 编辑