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
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
题目链接:点击打开链接
题意:
给定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
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
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
题目链接:点击打开链接
题意:给定一个图包含n个点,m条容量为1的有向边,问只翻转一条边能使s到t的最大流增大到多少?有多少种方法?
思路:先跑一遍最大流,在残余流量里把点分为为两个集合,第一个集合包含所有从起点能到达的点,第二个集合包含所有能到达终点的点,那么答案就是起点在第二个集合终点在第一个集合的边的条数(两个集合都不包含的点忽略)。
cpp代码:
#include
#includ...
分类:
其他好文 时间:
2015-05-06 17:39:55
阅读次数:
135
import re -- 所有正则表达式相关的功能都包含在re模块中re.sub() -- 字符串替换>>> import re>>> s= "100 NORTH BROAD ROAD">>> re.sub('ROAD$','RD.',s)'100 NORTH BROAD RD.'>>> s = "...
分类:
编程语言 时间:
2015-05-06 15:04:07
阅读次数:
185
Making the Grade
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 4647
Accepted: 2202
Description
A straight dirt road connects two fields on FJ's farm, b...
分类:
其他好文 时间:
2015-05-06 00:01:54
阅读次数:
147
最短路+拓扑序DP orz zyf & lyd 统计每条边在多少条最短路径上……其实可以统计 有多少条最短路径经过了x,以及y出发到达任意一个结束点有多少种走法(沿最短路) 我们可以用Dijkstra求出以 i 为起点的最短路径图,它是一个DAG,然后我们用dij扩展的顺序(一个拓扑序)来搞D...
分类:
其他好文 时间:
2015-05-05 23:44:33
阅读次数:
178
Description
AME decided to destroy CH’s country. In CH’ country, There are N villages, which are numbered from 1 to N. We say two village A and B are connected, if and only if there is a road betwe...
分类:
其他好文 时间:
2015-05-03 20:38:31
阅读次数:
149