TLE on SPOJ FASTFLOW

Revision en1, by sherewillpower, 2017-07-03 15:55:01

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.

Tags spoj, fastflow

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English sherewillpower 2017-07-03 15:55:01 472 Initial revision (published)