Unable to solve Max-Flow problem on Spoj

Revision en1, by arun_prasad, 2016-07-23 09:14:23

I was trying to solve this problem on Spoj . Click Here.

After spending a couple of hours on this I could only come up with a dfs solution which obviously got TLE.

Then I looked for help online and i found this quora solution QUORA SOLUTION .

Can someone tell me with an example and proof of the extra nodes to be added and why maxflow should be 2 for it to be right?

Tags spoj, maxflow, help needed

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English arun_prasad 2016-07-23 09:14:23 559 Initial revision (published)