This Is The Proplem : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1452
Im Trying To Solve This Proplem And Still Getting TLE (Using Edmond Karp Algo) And I try To use Ford-Fulkerson
Algo i got WA can any one help is there any way to implement Edomng karp algo to solve this proplem
note : i tried to use AdjList with Edmon Karp And Still Getting TLE.
This Is The Code : http://ideone.com/Sk1fKN.
Explaning For The Code :
First I Connect The members with parties ( Flow[party][member] = 1).
Second I Connect The clubs with members ( Flow[members][clubs] = 1).
Third I connect The Sink ( wich equal 2 here ) With The Club ( Flow[clubs][2] = 1).
Fourth And Last I connect the party With The source ( Flow[source][party] = The Size of Clubs — 1 / 2 ).
And Then Run The Edmond Karp Algo
And Then I Get TLE.
I'm Asking For Help Because Im Trying To Solve This Proplem From Yesterday
Thanks .
note ( Im Asking For Help Not For DownVotes ).