题意:二维地图上有人和房子,每个人要到一个房子里去,一个房子只能容纳一个人,每个人的费用为走的距离。求最小费用。...
分类:
其他好文 时间:
2015-05-15 09:12:48
阅读次数:
157
题目大意:在[1,n][1,n]区间内选择一些数,使得这些数两两互质,求这些数的和的最大值容易发现对于一个最优解,每个质数存在且仅存在于一个数中。(废话。
但是有可能一个数中存在多个质数
下面是两个结论:
1.一个数中最多存在两个不同的质数
2.这两个质数一个<n√n√>\sqrt n
我完全不会证明这两个结论,这两个结论都是官方题解里的
然后就好办了,我们对于<...
分类:
其他好文 时间:
2015-05-14 22:05:46
阅读次数:
180
解题报告 之 POJ 3680 Intervals 最小费用流 标号法 ACM 负权边
You are given N weighted open intervals. The ith interval covers (ai, bi) and weighs wi. Your task is to pick some of the intervals to maximize the total weights under the limit that no point in the real axis is ...
分类:
其他好文 时间:
2015-05-02 12:33:21
阅读次数:
184
POJ2175 Evacuation Plan 最小费用流 负权消去
The City has a number of municipal buildings and a number of fallout shelters that were build specially to hide municipal workers in case of a nuclear war. Each fallout shelter has a limited capacity in terms of a numbe...
分类:
其他好文 时间:
2015-05-02 09:54:06
阅读次数:
200
最大流 最小费用流 POJ3686 The Windy's
The Windy's is a world famous toy factory that owns M top-class workshop to make toys. This year the manager receives N orders for toys. The manager knows that every order will take different amount of hours in different work...
TransportationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2301Accepted Submission(s): 966Probl...
分类:
其他好文 时间:
2015-04-29 21:28:49
阅读次数:
129
POJ2135 Farm Tour 最大流 最小费用流
When FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields numbered 1..N, the first of which contains his house and the Nth of which contains the big barn. A total M (1 <...
分类:
其他好文 时间:
2015-04-29 11:54:17
阅读次数:
151
1 bool spfa(int s, int t) { 2 queue Q; 3 Q.push(s); 4 rst(d, inf); 5 rst(p, -1); 6 rst(pp, -1); 7 d[s] = 0; 8 vis[s] = tr...
分类:
其他好文 时间:
2015-04-25 18:17:05
阅读次数:
143
看目录就好了。不用看具体部分
网络流
二分图
最大匹配
最小点覆盖
最小边覆盖
最小路径覆盖
最大独立集
最大流
上下界最大流
最小割
全局最小割
费用流
上下界费用流
线性规划转费用流
最大权闭合图
RMQ优化建图
单纯形
字符串相关
hash
KMP
扩展KMP
Ma...
分类:
其他好文 时间:
2015-04-23 09:33:21
阅读次数:
437
题目链接:点击打开链接
题意:
给定n个点m条有向边的图, 起点s ,终点t
下面m条边 u,v, a,b 若选择这条边花费为a, 不选择花费为b
构造一条欧拉通路使得起点是s,终点是t,且花费最小。
思路:
首先能想到一个简单的思路:假设所有边都选择,然后在费用流里跑,就会出现负环的问题。。
所以为了避免负环,让所有费用都为正值:
int sum = 0;
若a>b, 则 费...
分类:
其他好文 时间:
2015-04-22 15:18:43
阅读次数:
160