题目链接:http://poj.org/problem?id=3621 Sightseeing Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11526 Accepted: 3930 Description Farmer John has decided to reward his cows for their hard work by taking them on a tour of the big ci…
题意:给出 n 个点 m 条有向边,要求选出一个环,使得这上面 点权和/边权和 最大. 析:同样转成是01分数规划的形式,F / L 要这个值最大,也就是 G(r) = F - L * r 这个值为0时,r 的值,然后对于 F > 0,很明显是 r 太小,但是不好判断,把这个值取反,这样的话就能用Bellan-Ford 来判是不是有负环了,也可以用spfa. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000")…
Sightseeing Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10306 Accepted: 3519 Description Farmer John has decided to reward his cows for their hard work by taking them on a tour of the big city! The cows must decide how best to…
Sightseeing Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9703 Accepted: 3299 Description Farmer John has decided to reward his cows for their hard work by taking them on a tour of the big city! The cows must decide how best to…