摘要: View Code 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define N 1005 7 #define inf 9999999 8 int map[N][N],path[N],flow[N]; 9 int start,eend,ans,n,m;10 11 int bfs(){12 int t,i;13 queueq;14 while(!q.empty())q.pop();15 memset(path,-1,sizeof(path));... 阅读全文
posted @ 2012-10-22 22:40 xxx0624 阅读(299) 评论(0) 推荐(0)
摘要: Ford-Fulkerson算法基本没什么技巧View Code 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define N 1005 7 #define inf 9999999 8 int map[N][N],pre[N],vis[N]; 9 int start,eend,ans;10 11 void max_flow(int n)12 {13 int i,j,k;14 while(1)15 {16 queueq;17 while(!q.... 阅读全文
posted @ 2012-10-22 22:33 xxx0624 阅读(301) 评论(0) 推荐(0)
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define N 100005 4 int next[N]; 5 int flag,len2,len1; 6 char str1[2*N],str2[N]; 7 8 void getnext() 9 {10 int i,j,k;11 memset(next,0,sizeof(next));12 next[0]=-1;13 j=0;14 k=-1;15 while(j<len2)16 {17 if(k==-1||s... 阅读全文
posted @ 2012-10-22 21:25 xxx0624 阅读(291) 评论(0) 推荐(0)