Hello, I tried to solve this problem https://www.spoj.com/problems/FASTFLOW/ but I’m getting wrong answer. This is my first time learning about maximum flow. I’m using Dinic Algorithm to slove it, but there is something that I don’t understand. In this problem, the graph is undirected but in the article that I’m reading the graph is directed, and there is source and sink, so in this problem I’m assuming the source is node 1 and the sink is node N, correct me if I’m wrong about that.
Here’s my implementation:
EDIT: Code removed. Already accepted, I just need to add negative flow to the reverse edge.