找出若干个环覆盖所有的点,使得总的花费最小因为每个点只能经过一次,所以很快就可想到拆点求最小费用流建图:S->i 费用为0 流量为1i+n->T同上若有边u->vu->v+n 费用为边权,容量为1最后套套模板求一次最小费用流,如果流量等于n,表示每个点都遍历了一次,输出最小费用即可View Code #include <iostream>#include <algorithm>#include <string>#include <stdio.h>#include <string.h>#include <s Read More
posted @ 2012-03-26 11:20
Because Of You
Views(869)
Comments(0)
Diggs(0)
从网上找的模板,测试了一下View Code #include <iostream>#include <algorithm>#include <string>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <memory.h>#include <queue>#include <vector>#include <cmath>using namespace std;int sumFlow;const Read More
posted @ 2012-03-26 11:14
Because Of You
Views(827)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号