码迷,mamicode.com
首页 >  
搜索关键字:road constructions    ( 669个结果
Codeforces 543D Road Improvement(DP)
题目链接 Solution 比较明显的树形DP模型。 首先可以先用一次DFS求出以1为根时,sum[i](以i为子树的根时,满足要求的子树的个数)。 考虑将根从i变换到它的儿子j时,sum[i]产生的变化. 在变化前sum[i]不为0时,可以用求逆元的方法求出新的sum[i]. ...
分类:其他好文   时间:2015-05-19 22:08:19    阅读次数:106
单元最短路径算法模板汇总(Dijkstra, BF,SPFA),附链式前向星模板
一:dijkstra算法时间复杂度,用优先级队列优化的话,O((M+N)logN)求单源最短路径,要求所有边的权值非负。若图中出现权值为负的边,Dijkstra算法就会失效,求出的最短路径就可能是错的。设road[i][j]表示相邻的i到j的路长U集合存储已经求得的到源点最短路径的节点,S集合表示还...
分类:编程语言   时间:2015-05-19 12:10:38    阅读次数:244
csu 1548: Design road(三分)
1548: Design road Time Limit: 2 Sec  Memory Limit: 256 MB Submit: 243  Solved: 115 [Submit][Status][Web Board] Description You need to design road from (0, 0) to (x, y) in plane with the lo...
分类:其他好文   时间:2015-05-18 09:06:42    阅读次数:89
AOJ-2249 Road Construction(最短路)
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=45523有一个国王想在首都与各个城市之间修建公路,但是他的预算太高,所以必须要降低预算。为了降低预算,必须要有新计划,新计划必须满足每两个城市都连通,首都和城市的最短距离不会改变...
分类:其他好文   时间:2015-05-17 20:02:21    阅读次数:94
Codeforces544D:Destroying Roads(最短路)
In some country there are exactly n cities and m bidirectional roads connecting the cities. Cities are numbered with integers from 1 to n. If cities a and b are connected by a road, then in an h...
分类:其他好文   时间:2015-05-15 15:41:29    阅读次数:255
[Oracle]在数据库中实现地图匹配
The method to do the map match1 The algorithm proceduresFirst ,we should find the most nearest road to the point from all roads in haerbin;Second, we ...
分类:数据库   时间:2015-05-13 21:17:38    阅读次数:164
Codeforces 543D Road Improvement 树形dp
题目链接:点击打开链接 题意: 给定n个点的树 问: 对于以i为根时,把树边黑白染色,使得任意点走到根的路径上不超过一条黑边,输出染色的方案数(mod 1e9+7) 思路: 显然i点的方案数 = i为根的子树的方案数 * 不包括i为根的子树的部分的方案数 首先以i为根的子树求一个方案数down[i]:for all son vj  of i, down[i] = multiply d...
分类:其他好文   时间:2015-05-09 22:08:20    阅读次数:156
A-Making the Grade(POJ 3666)
Making the GradeTime Limit:1000MSMemory Limit:65536KTotal Submissions:4656Accepted:2206DescriptionA straight dirt road connects two fields on FJ's far...
分类:其他好文   时间:2015-05-08 14:27:46    阅读次数:95
hdu 1596 find the safest road(dijkstra||floyd)
find the safest road Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8192    Accepted Submission(s): 2901 Problem Description XX星球有很多城...
分类:其他好文   时间:2015-05-07 22:13:27    阅读次数:172
jag2014autumn F Reverse a Road II 网络流
题目链接:点击打开链接 题意:给定一个图包含n个点,m条容量为1的有向边,问只翻转一条边能使s到t的最大流增大到多少?有多少种方法? 思路:先跑一遍最大流,在残余流量里把点分为为两个集合,第一个集合包含所有从起点能到达的点,第二个集合包含所有能到达终点的点,那么答案就是起点在第二个集合终点在第一个集合的边的条数(两个集合都不包含的点忽略)。 cpp代码: #include #includ...
分类:其他好文   时间:2015-05-06 17:39:55    阅读次数:135
669条   上一页 1 ... 49 50 51 52 53 ... 67 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!