Network flow problem [24] [Luogu P2756] pilot program pairing problems

Subject to the effect:

You have a bipartite graph, respectively, to obtain two points of the number of matches its respective matching connection.

text:

This network flow problem consider, find the number of matches is bipartite graph matching template, but we also require two points of each matching connector.

Stream from the network ( \ (\ texttt Dinic} {\) angle) to think, I think what features matching edges. (To give you a few seconds thinking time) we found the right side edge of the original is not matched ( \ (= 1 \) ), has changed, then only to determine whether to change the line.

Code:

for (int i = 2; i <= tot; i += 2)
{
    if(e[i].y != s && e[e[i].op].y != s && e[i].y != t
         && e[e[i].op].y != t)
    {
        if(e[i].w == 1)
            printf("%d %d\n", e[i].y, e[e[i].op].y);
    }
}

Guess you like

Origin www.cnblogs.com/GJY-JURUO/p/12207729.html