Documente Academic
Documente Profesional
Documente Cultură
Flux maxim
Nechita Vlad-Mihai
28 Ianuarie 2023
i n t main ( )
{
// C i t i r e a d a t e l o r de i n t r a r e
for x in L
{
f o r ( i = 1 ; i <= | L | ; i ++) v i z [ i ] = 0 ;
dfs (x ) ;
}
}
1
b o o l d f s ( nod )
{
v i z [ nod ] = 1 ;
f o r x i n N nod
i f ( p [ x ] == −1 | | ( v i z [ p [ x ] ] == 0 && d f s ( p [ x ] ) == 1 ) )
{
p [ x ] = nod ;
return true ;
}
return f a l s e ;
}
https://infoarena.ro/job_detail/2971805?action=view-source
2 Flux maxim
2.1 Algoritmul lui Ford-Fulkerson
F - Fluxul maxim, C - Capacitatea maxima a unei muchii
m - Nr. de muchii, n - Nr. de noduri
2
Exemplu de cod:
https://infoarena.ro/job_detail/2971795?action=view-source
Complexitate: O(F ∗ m)
3 Linkuri utile
https://cp-algorithms.com/graph/kuhn_maximum_bipartite_matching.html
https://cp-algorithms.com/graph/edmonds_karp.html
https://cp-algorithms.com/graph/dinic.html
https://www.youtube.com/playlist?list=PLrS21S1jm43igE57Ye_edwds_iL7ZOAG4
https://www.youtube.com/playlist?list=PLDV1Zeh2NRsDj3NzHbbFIC58etjZhiGcG
3
4 Probleme de facut in clasa
https://infoarena.ro/problema/cuplaj
https://infoarena.ro/problema/maxflow
https://www.pbinfo.ro/probleme/4014/rearanjaresir
https://atcoder.jp/contests/abc091/tasks/arc092_a?lang=en