When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

silversRayleigh's blog

By silversRayleigh, 5 years ago, In English

Hello Everyone. I was trying to solve this problem using Dinic algorithm. Since, I have never used the algorithm before, there are some bugs in my code which I am unable to find. I have spent considerable amount of time trying to debug it. Can anyone please help me in debugging my code?

Link to code : https://repl.it/@NikhilAgrawal/RoastedAdoredOpposites

TIA!

| Write comment?
»
5 years ago, # |
  Vote: I like it -9 Vote: I do not like it

Why use Dinic's?

You can use Orlin's + King-Rao-Tarjan algorithm, which solves it without the logarithmic factor and is very very simple to code in no more than 250 lines of code.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I wanted to practice Dinic's algorithm first but I am stuck. :( Please help if you can.

»
5 years ago, # |
  Vote: I like it +22 Vote: I do not like it

It seems like you meant if here:

while(!bfs(src, des))
      break;