I am trying to learn Dinic's algorithm to find max flow for a given graph. However my implementation for the same is timing out for the 11th pretest for the question FASTFLOW on SPOJ whatever I do. It's been a day and I haven't been able to find the fault. Please can anyone help me optimize my code further?
Link to question : http://www.spoj.com/problems/FASTFLOW/
My code: http://ideone.com/7FFYRy
Any help would be appreciated, Thank you.