摘要:
题意:求从顶点1走到n再走回1的最短路径,每条边只能走一次。解法:最小费用最大流,另设源点汇点,从源点到1连边,从n到汇点连边,这两条边都是容量为2,费用为0,表示要走两条包含源点(或汇点)的边,因为一去一回走的边不一样。。其余的边正常建就行,费用就是路径长度。。 1 #include<cstdio> 2 #include<cstring> 3 #include<queue> 4 #include<algorithm> 5 #define N 1010 6 using namespace std; 7 const int inf=1<< 阅读全文
posted @ 2013-01-20 16:16
silver__bullet
阅读(197)
评论(0)
推荐(0)

浙公网安备 33010602011771号