题意:给出人物关系图,要把一个通知告诉所有人,告诉每一个人有一个费用,现在想知道最小通知的人与费用。
思路:利用Tarjan算法,对原图进行缩点,然后找出入度为0 的点,那么这个人是必须要通知的,由于经过缩点,所以,如果这个点是缩点来的,那就枚举下这个点里的任一个点,找到最小的费用点。
#include
#include
#include...
分类:
其他好文 时间:
2015-08-27 13:22:17
阅读次数:
241
题意:判定给出的有向图是不是强连通图
Tarjan算法模板题目
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2015-08-26 20:12:29
阅读次数:
189
传送门:BZOJ1051Tarjan算法求强联通分量,缩点,记录出度。
现学的Tarjan算法……++cnt写错了orz。
最近眼睛不舒服,做题好慢……代码上的小细节见下。#include
#include
#include
#include
#include
#include ...
分类:
其他好文 时间:
2015-08-21 23:32:10
阅读次数:
308
SPFTime Limit:1000MSMemory Limit:10000KTotal Submissions:7110Accepted:3242DescriptionConsider the two networks shown be...
分类:
其他好文 时间:
2015-08-20 01:18:55
阅读次数:
135
Popular Cows
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 27198
Accepted: 10963
Description
Every cow's dream is to become the most popular cow in the...
分类:
其他好文 时间:
2015-08-19 20:47:09
阅读次数:
145
Redundant Paths
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10798
Accepted: 4626
Description
In order to get from one of the F (1 <= F <= 5,000) graz...
分类:
其他好文 时间:
2015-08-18 16:24:09
阅读次数:
189
题目大意:给出N个点,和每个点物品的售价,现在有一个商人,要从u点到v点,他想在路上多赚点钱。他可以从一个城市买物品,然后再卖到另一个城市,但买卖只允许一次,且不能回头走
问最多能赚多少解题思路:果然智商捉急了。。
up数组纪录当前点到lca的最大利润
down数组纪录lca到当前点的最大利润
Max数组lca到当前点的最大值
Min纪录当前点到lca的最小值这样的话,执行tarjan的时...
分类:
其他好文 时间:
2015-08-18 01:18:16
阅读次数:
122
Network of SchoolsDescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each school ...
分类:
Web程序 时间:
2015-08-17 23:29:10
阅读次数:
285
图论题:一开始我是用tarjan算法做的,wrong answer 了很多次,然后又用了floyd-warshell算法,也wa了最后找了题解,原来最后的dataset后面不是组数,是样例的编号,题根本就没说,让人怎么理解。。。tarjan#include#include#include#inclu...
分类:
移动开发 时间:
2015-08-17 23:05:56
阅读次数:
212
Problem DescriptionTo prove two sets A and B are equivalent, we can first prove A is a subset of B, and then prove B is a subset of A, so finally we g...
分类:
其他好文 时间:
2015-08-17 21:43:43
阅读次数:
156