Your algo doesn't work for misof's test case posted above. If you remove the edgesayon wrote:can anyone verify whether my algorithm is correct? i am getting wa, i checked all inputs posted in this board.

- assign capacity 1 to each edges of the graph and simply run maxflow

- if maxflow < 2 then Back to jail

- remove edges where no flow occured(i.e where still have residual capacity)

- run dijkstra, get cost1

- remove dijkstra edges

- run dijkstra again, get cost2

- output cost1+cost2

please give me some counter-example if you find, or some more test cases, thanks

**1-3**and

**2-6**in the third step, you will not find the optimal solution:

**1-3-6**and

**1-2-6**.