码迷,mamicode.com
首页 >  
搜索关键字:numbering paths    ( 1424个结果
POJ 3352 Road Construction POJ 3177 Redundant Paths(边双连通图 Tarjan+缩点)
POJ 3352 Road Construction POJ 3177 Redundant Paths(边双连通图 Tarjan+缩点) ACM 题目地址:  POJ 3352 Road Construction  POJ 3177 Redundant Paths 题意:  问要添加几条边才能使所给无向图图变成边双连通图。 分析:  边连通度:使无向图G不连通的最少...
分类:其他好文   时间:2014-08-15 12:54:58    阅读次数:178
POJ3177Redundant Paths(边的双连通性,用vector时一定要去掉重边)
Redundant Paths Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9118   Accepted: 3925 Description In order to get from one of the F (1 <= F <= 5,000) grazing...
分类:其他好文   时间:2014-08-13 19:03:27    阅读次数:264
Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:其他好文   时间:2014-08-13 14:39:26    阅读次数:153
uva10564 - Paths through the Hourglass(递推)
题目:uva10564 - Paths through the Hourglass(递推) 题目大意:给出这样的两个数塔,然后给出一个值,问你能否从这个数塔中找到路径,路径上的值之和等于这个数,输出这样的路径的总数,如果多条打印路径先挑开始的位置(0..n - 1)最小的,如果这样还是有多条,在比较后面的向左向右字典序最小的。 解题思路:一开始两个数塔一个正着推,一个倒着推,结...
分类:其他好文   时间:2014-08-13 01:14:25    阅读次数:302
Unique Paths II
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:其他好文   时间:2014-08-12 16:40:14    阅读次数:157
[leetcode]Unique Paths II
Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle an...
分类:其他好文   时间:2014-08-08 23:55:17    阅读次数:263
HDU 4912 Paths on the tree
http://acm.hdu.edu.cn/showproblem.php?pid=4912题意:给一棵树,再给一些路径,求最多有多少条路径不相交。题解:主要是贪心的想法。用LCA处理出路径的层数,然后从最深处的节点往上找。因为节点越深,对其他路径影响度越小,相交的可能性越低。需要手动扩栈。 1 ....
分类:其他好文   时间:2014-08-07 09:44:10    阅读次数:209
hdu4912 Paths on the tree --- LCA贪心
给一棵n个结点的树,m条路径的起点和终点, 问至多可以选择多少条路径使其两两间没有公共点。 这题的主要问题是, 1、如何判断两条路径上没有交点 2、按什么策略来选 看上去感觉是最大匹配问题,但nm的范围较大问题1无法高效的解决。 画个图发现可能和LCA有关,但比赛时不知道这到底有什么用,完全没想贪心。 要选择尽量多,就是要尽量避免冲突。 我们选择一个点作为根,把给的边画出来...
分类:其他好文   时间:2014-08-06 23:06:12    阅读次数:282
HDU 4912 LCA+贪心
Paths on the treeTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 531Accepted Submission(s): 182P...
分类:其他好文   时间:2014-08-06 22:48:32    阅读次数:302
HDU 4912 Paths on the tree
题目: 给定一棵树和一些路径  问  最多能选出多少路径放在树上  使得各个路径间没有点交叉 思路: LCA+贪心 对于一条路径  我们可以将它分成两部分  即 从u到lca 和 从v到lca  易知lca位于树上深度最浅的地方  而且如果这个lca被一条路径覆盖了  那么下面的子树都相当于被覆盖了 考虑到以x点为上述的lca点  那么如何选择经过x的路径呢  可以想到如果一条路...
分类:其他好文   时间:2014-08-06 14:51:44    阅读次数:180
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!