<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ta.in.th/index.php?action=history&amp;feed=atom&amp;title=Max_Flow</id>
	<title>Max Flow - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ta.in.th/index.php?action=history&amp;feed=atom&amp;title=Max_Flow"/>
	<link rel="alternate" type="text/html" href="https://wiki.ta.in.th/index.php?title=Max_Flow&amp;action=history"/>
	<updated>2026-06-16T22:59:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0-alpha</generator>
	<entry>
		<id>https://wiki.ta.in.th/index.php?title=Max_Flow&amp;diff=96&amp;oldid=prev</id>
		<title>Tata: Created page with &quot;Max Flow imprement with scaling algorithm O(nmlgU)   #include&lt;stdio.h&gt;  #include&lt;algorithm&gt;  #include&lt;vector&gt;  #define INF 2000000000  using namespace std;  struct Edge  {  	i...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.ta.in.th/index.php?title=Max_Flow&amp;diff=96&amp;oldid=prev"/>
		<updated>2019-03-07T17:15:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Max Flow imprement with scaling algorithm O(nmlgU)   #include&amp;lt;stdio.h&amp;gt;  #include&amp;lt;algorithm&amp;gt;  #include&amp;lt;vector&amp;gt;  #define INF 2000000000  using namespace std;  struct Edge  {  	i...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Max Flow imprement with scaling algorithm O(nmlgU)&lt;br /&gt;
&lt;br /&gt;
 #include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include&amp;lt;algorithm&amp;gt;&lt;br /&gt;
 #include&amp;lt;vector&amp;gt;&lt;br /&gt;
 #define INF 2000000000&lt;br /&gt;
 using namespace std;&lt;br /&gt;
 struct Edge&lt;br /&gt;
 {&lt;br /&gt;
 	int v,w,u;&lt;br /&gt;
 };&lt;br /&gt;
 vector&amp;lt;Edge*&amp;gt; E[1005];&lt;br /&gt;
 int ch[1005];&lt;br /&gt;
 Edge *root;&lt;br /&gt;
 int T;&lt;br /&gt;
 bool dfs(int x,int lt,int k)&lt;br /&gt;
 {&lt;br /&gt;
 	int a;&lt;br /&gt;
 	if(x==lt)&lt;br /&gt;
 		return 1;&lt;br /&gt;
 	ch[x]=T;&lt;br /&gt;
 	for(a=0;a&amp;lt;E[x].size();a++)&lt;br /&gt;
 		if(ch[E[x][a]-&amp;gt;w]!=T &amp;amp;&amp;amp; E[x][a]-&amp;gt;u&amp;gt;=k)&lt;br /&gt;
 			if(dfs(E[x][a]-&amp;gt;w,lt,k))&lt;br /&gt;
 			{&lt;br /&gt;
 				E[x][a]-&amp;gt;u-=k;&lt;br /&gt;
 				if((E[x][a]-root)%2)&lt;br /&gt;
 					root[E[x][a]-root-1].u+=k;&lt;br /&gt;
 				else&lt;br /&gt;
 					root[E[x][a]-root+1].u+=k;&lt;br /&gt;
 				return 1;&lt;br /&gt;
 			}&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 int maxflow(int n,int m,int s,int t,Edge *edges,int *f)&lt;br /&gt;
 {&lt;br /&gt;
 	int a,k=0;&lt;br /&gt;
 	bool tmp;&lt;br /&gt;
 	root=edges;&lt;br /&gt;
 	for(a=0;a&amp;lt;m;a++)&lt;br /&gt;
 	{&lt;br /&gt;
 		E[edges[a].v].push_back(&amp;amp;edges[a]);&lt;br /&gt;
 		f[a]=edges[a].u;&lt;br /&gt;
 		if(k&amp;lt;f[a])	k=f[a];&lt;br /&gt;
 	}&lt;br /&gt;
 	for(T=1;k&amp;gt;0;T++)&lt;br /&gt;
 		if(!dfs(s,t,k))&lt;br /&gt;
 			k/=2;	//maxflow ver. scaling algor O(nmlgU)&lt;br /&gt;
 	for(a=0;a&amp;lt;m;a++)&lt;br /&gt;
 		f[a]-=edges[a].u;&lt;br /&gt;
 	for(a=0,k=0;a&amp;lt;E[t].size();a++)&lt;br /&gt;
 		k+=E[t][a]-&amp;gt;u;&lt;br /&gt;
 	return k;&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Tata</name></author>
		
	</entry>
</feed>