随笔分类 -  图论

摘要:Dylans loves tree 阅读全文
posted @ 2015-06-25 15:36 ForeverEnjoy 阅读(185) 评论(0) 推荐(0)
摘要:比较好的讲解:http://blog.csdn.net/wsniyufang/article/details/6747392 view code//首先为除根之外的每个点选定一条入边,这条入边一定要是所有入边中最小的。 //现在所有的最小 入边都选择出来了,如果这个入边集不存在有向环的话,我们 //可以证明这个集合就是该图的最小树形图。这个证明并不是很难。如果存在有向 //环的话,我们就要将这 个... 阅读全文
posted @ 2014-08-20 23:55 ForeverEnjoy 阅读(189) 评论(0) 推荐(0)
摘要:这题是混合路的欧拉路径问题。 1.判断图的连通性,若不连通,无解。 2.给无向边任意定向,计算每个结点入度和出度之差deg[i]。deg[i]为奇数的结点个数只能是0个或2个,否则肯定无解。 3.(若存在2个deg[i]为奇数的结点,则在两点连一条流量为1的边,方向任意)设立源点s和汇点t(自己另外 阅读全文
posted @ 2014-08-18 10:30 ForeverEnjoy 阅读(260) 评论(0) 推荐(0)
摘要:Wow! Such Conquering! Problem Description There are n Doge Planets in the Doge Space. The conqueror of Doge Space is Super Doge, who is going to inspe 阅读全文
posted @ 2014-08-18 00:13 ForeverEnjoy 阅读(422) 评论(0) 推荐(0)
摘要:poj 3237 tree inline : 1. inline 定义的类的内联函数,函数的代码被放入符号表中,在使用时直接进行替换,(像宏一样展开),没有了调用的开销,效率也很高。 2. 很明显,类的内联函数也是一个真正的函数,编译器在调用一个内联函数时,会首先检查它的参数的类型,保证调用正确。然 阅读全文
posted @ 2014-08-17 00:04 ForeverEnjoy 阅读(187) 评论(0) 推荐(0)
摘要:The Subtle Balloons Company (SBC) is the main balloon provider for programming contests; it hashuge factories and warehouses, as well as an extensive 阅读全文
posted @ 2014-08-14 01:28 ForeverEnjoy 阅读(470) 评论(0) 推荐(0)
摘要:题意:给定一些木棒,木棒两端都涂上颜色,求是否能将木棒首尾相接,连成一条直线,要求不同木棒相接的一边必须是相同颜色的。 无向图存在欧拉路的充要条件为: ① 图是连通的; ② 所有节点的度为偶数,或者有且只有两个度为奇数的节点。 图的连通可以利用并查集去判断。 度数的统计比较容易。 代码实现 //第一次用指针写trie,本来是用二维数组,发现数组开不下,只好删... 阅读全文
posted @ 2014-08-08 10:55 ForeverEnjoy 阅读(152) 评论(0) 推荐(0)
摘要:题目:Shoot the Bullet 收藏:http://www.tuicool.com/articles/QRr2Qb 把每一天看成一个点,每个女孩也看成一个点,增加源和汇s、t,源向每一天连上[0,d]的边,每一天与每个女孩如果有拍照任务的话连上[l,r]的边, 每个女孩与汇连上[g,oo]的 阅读全文
posted @ 2014-08-05 23:43 ForeverEnjoy 阅读(200) 评论(0) 推荐(0)
摘要:view code//hdu 3987 #include #include #include #include #include using namespace std; typedef long long ll; const ll INF = 1LLq; q.push(s); d[s] = 0; vis[s] = 1; while(!q.empty()... 阅读全文
posted @ 2014-08-05 17:07 ForeverEnjoy 阅读(153) 评论(0) 推荐(0)
摘要:Ombrophobic Bovines Time Limit: 1000MSMemory Limit: 65536K Total Submissions: 14519Accepted: 3170 Description FJ's cows really hate getting wet so muc 阅读全文
posted @ 2014-08-05 13:44 ForeverEnjoy 阅读(242) 评论(0) 推荐(0)
摘要:Pseudoforest Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1705 Accepted Submission(s): 653 P 阅读全文
posted @ 2014-07-30 09:33 ForeverEnjoy 阅读(196) 评论(0) 推荐(0)
摘要:Computer Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3075 Accepted Submission(s): 1561 Proble 阅读全文
posted @ 2014-07-29 10:19 ForeverEnjoy 阅读(520) 评论(0) 推荐(1)
摘要:Dragon BallsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2909 Accepted Submission(s): 1125Prob... 阅读全文
posted @ 2014-07-28 14:12 ForeverEnjoy 阅读(178) 评论(0) 推荐(0)
摘要:Connections between cities Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4425 Accepted Submis 阅读全文
posted @ 2014-07-28 14:00 ForeverEnjoy 阅读(186) 评论(0) 推荐(0)
摘要:最大流裸题,贴下模版 阅读全文
posted @ 2014-07-21 19:07 ForeverEnjoy 阅读(137) 评论(0) 推荐(0)
摘要:算法入门经典训练指南88页练习 ::这道题只要把原矩阵扩大4倍,那么其跟最大子矩阵的题目就很类似,把二维转化成一维,求最大的序列和,不过这个序列的长度不能超过n。 长度不能超过n? 那这道题又跟hdu 3415 HDU 3415 Max Sum of Max-K-sub-sequence (单调队列 阅读全文
posted @ 2014-05-29 23:17 ForeverEnjoy 阅读(214) 评论(0) 推荐(0)
摘要:Jurassic Remains Time Limit: 18000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu [Submit] [Go Back] [Status] Description Paleontologists in Sib 阅读全文
posted @ 2014-05-29 16:56 ForeverEnjoy 阅读(189) 评论(0) 推荐(0)
摘要:Command Network Time Limit: 1000MSMemory Limit: 131072K Total Submissions: 11970Accepted: 3482 Description After a long lasting war on words, a war on 阅读全文
posted @ 2014-05-09 19:52 ForeverEnjoy 阅读(282) 评论(0) 推荐(0)
摘要:A - Airport ExpressTime Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %lluAppoint description: System Crawler (2014-03-01)DescriptionProblem D:... 阅读全文
posted @ 2014-04-16 09:14 ForeverEnjoy 阅读(341) 评论(0) 推荐(0)
摘要:Problem 2150 Fire Game Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At th 阅读全文
posted @ 2014-03-30 21:06 ForeverEnjoy 阅读(922) 评论(0) 推荐(0)