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?