Electric Town - Editorial

Problem link : contest
practice

Difficulty : Medium

Pre-requisites : max flow

Solution :

We can construct a flow network from the graph. We can notice that answer of each query would be to apply max flow considering A as source and B as target.

For finding max flow in graph, we can use Edmond Karp, Ford Fulkerson, Dinic’s algorithm etc. Any of them would have worked here.

Setter’s solution: link

But how do you explain solutions like these - http://www.codechef.com/viewsolution/4938959

I can’t. It is really weird to see such kind of solutions. Test data should have been more stronger :frowning:

1 Like
//